instead of
rust
println!("{}", "Hello world");
suggest
rust
println!("Hello world");
which can be noticeably faster
test tests::bench_inline ... bench: 46,300 ns/iter (+/- 2,643)
test tests::bench_inline_format ... bench: 78,796 ns/iter (+/- 10,303)
@matthiaskrgr I'd like to take a stab at this if you don't mind!
I do absolutely not mind :D
Btw I just saw there already is a format!("{}", "bla"); lint here: https://github.com/rust-lang-nursery/rust-clippy/blob/master/clippy_lints/src/format.rs#L39
maybe it's possible to reuse some code :)
Thanks for pointing me to that! I had been looking at print.rs.
I'll try to get something you can take a look at tonight/tomorrow. I'm starting with the simple case:
println!("{}", "foo");
but I imagine we'll want to parse the args for the general case
println!("{} {}", some_var, "foo");
Yeah, if we have
println!("{} {}", some_var, "foo");
we could inline like this:
println!("{} foo", some_var);
@matthiaskrgr See #2608 -- sorry for the delay!
Looks like it's working fine, closing the ticket =)