File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ pub trait Write {
189189 /// ```
190190 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
191191 fn write_fmt ( mut self : & mut Self , args : Arguments < ' _ > ) -> Result {
192- write ( & mut self , args)
192+ if let Some ( s ) = args . as_str ( ) { self . write_str ( s ) } else { write ( & mut self , args) }
193193 }
194194}
195195
Original file line number Diff line number Diff line change @@ -1649,6 +1649,10 @@ pub trait Write {
16491649 /// ```
16501650 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
16511651 fn write_fmt ( & mut self , fmt : fmt:: Arguments < ' _ > ) -> Result < ( ) > {
1652+ if let Some ( s) = fmt. as_str ( ) {
1653+ return self . write_all ( s. as_bytes ( ) ) ;
1654+ }
1655+
16521656 // Create a shim which translates a Write to a fmt::Write and saves
16531657 // off I/O errors. instead of discarding them
16541658 struct Adapter < ' a , T : ?Sized + ' a > {
You can’t perform that action at this time.
0 commit comments