2020-09-13 06:00:45 -05:00
|
|
|
// run-rustfix
|
|
|
|
#![warn(clippy::single_char_push_str)]
|
|
|
|
|
2020-09-14 08:31:04 -05:00
|
|
|
macro_rules! get_string {
|
|
|
|
() => {
|
|
|
|
String::from("Hello world!")
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-09-13 06:00:45 -05:00
|
|
|
fn main() {
|
|
|
|
let mut string = String::new();
|
|
|
|
string.insert_str(0, "R");
|
|
|
|
string.insert_str(1, "'");
|
|
|
|
|
|
|
|
string.insert(0, 'u');
|
|
|
|
string.insert_str(2, "st");
|
|
|
|
string.insert_str(0, "");
|
|
|
|
string.insert_str(0, "\x52");
|
|
|
|
string.insert_str(0, "\u{0052}");
|
|
|
|
let x: usize = 2;
|
|
|
|
string.insert_str(x, r##"a"##);
|
|
|
|
const Y: usize = 1;
|
|
|
|
string.insert_str(Y, r##"a"##);
|
2020-09-14 08:31:04 -05:00
|
|
|
|
|
|
|
get_string!().insert_str(1, "?");
|
2020-09-13 06:00:45 -05:00
|
|
|
}
|