File tree 2 files changed +5
-1
lines changed
2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ pub trait Write {
189
189
/// ```
190
190
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
191
191
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) }
193
193
}
194
194
}
195
195
Original file line number Diff line number Diff line change @@ -1649,6 +1649,10 @@ pub trait Write {
1649
1649
/// ```
1650
1650
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1651
1651
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
+
1652
1656
// Create a shim which translates a Write to a fmt::Write and saves
1653
1657
// off I/O errors. instead of discarding them
1654
1658
struct Adapter < ' a , T : ?Sized + ' a > {
You can’t perform that action at this time.
0 commit comments