File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -1019,9 +1019,9 @@ impl Literal {
1019
1019
. starts_with ( |next| '0' <= next && next <= '7' )
1020
1020
{
1021
1021
// circumvent clippy::octal_escapes lint
1022
- " \ \ x00"
1022
+ r" \x00"
1023
1023
} else {
1024
- " \ \ 0"
1024
+ r" \0"
1025
1025
} ,
1026
1026
) ;
1027
1027
} else if ch == '\'' {
@@ -1063,10 +1063,10 @@ impl Literal {
1063
1063
b'\n' => repr. push_str ( r"\n" ) ,
1064
1064
b'\r' => repr. push_str ( r"\r" ) ,
1065
1065
b'"' => repr. push_str ( "\\ \" " ) ,
1066
- b'\\' => repr. push_str ( " \\ \\ ") ,
1066
+ b'\\' => repr. push_str ( r" \\") ,
1067
1067
b'\x20' ..=b'\x7E' => repr. push ( b as char ) ,
1068
1068
_ => {
1069
- let _ = write ! ( repr, " \ \ x{:02X}", b) ;
1069
+ let _ = write ! ( repr, r" \x{:02X}", b) ;
1070
1070
}
1071
1071
}
1072
1072
}
Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ fn literal_c_string() {
189
189
#[ test]
190
190
fn literal_character ( ) {
191
191
assert_eq ! ( Literal :: character( 'x' ) . to_string( ) , "'x'" ) ;
192
- assert_eq ! ( Literal :: character( '\'' ) . to_string( ) , "' \ \ ''") ;
192
+ assert_eq ! ( Literal :: character( '\'' ) . to_string( ) , r"' \''") ;
193
193
assert_eq ! ( Literal :: character( '"' ) . to_string( ) , "'\" '" ) ;
194
194
}
195
195
@@ -378,7 +378,7 @@ fn roundtrip() {
378
378
roundtrip ( "'a" ) ;
379
379
roundtrip ( "'_" ) ;
380
380
roundtrip ( "'static" ) ;
381
- roundtrip ( "' \ \ u{10__FFFF}'") ;
381
+ roundtrip ( r"' \u{10__FFFF}'") ;
382
382
roundtrip ( "\" \\ u{10_F0FF__}foo\\ u{1_0_0_0__}\" " ) ;
383
383
}
384
384
You can’t perform that action at this time.
0 commit comments