Warns when using push_str with a single-character string literal, and push with a char would work fine.
clippy::style and clippy::perf (maybe clippy::pedantic?)char, since it's just a number and will be inlined, than to push a &'static str, which must be stored in the binary and accessed via a pointerNone.
let mut string = String::new();
string.push_str("R");
Could be written as:
let mut string = String::new();
string.push('R');
@rustbot modify labels to +A-style +A-performance
Hmm, rustbot's not responding...
@rustbot modify labels: -A-style
Okay, seems to work, just had to add rustbot with write permissions to this repo.
Correct me if I'm wrong, but this lint does not seem to working on the latest nightly. With this code:
// src/main.rs
fn main() {
let mut string = String::new();
string.push_str("R");
}
When I run nightly clippy, I don't get any warnings:
$ cargo +nightly clippy
Checking clippy-issue-5875 v0.1.0 (~/clippy-issue-5875)
Finished dev [unoptimized + debuginfo] target(s) in 0.11s
Output of cargo clippy --version:
clippy 0.0.212 (04488afe3 2020-08-24)
@camelid if I'm not mistaken, the clippy component is built now from the rust-lang/rust repo copy and not from this repo. The latest sync was merged yesterday (see here), so I think it should be available on the next nightly.
cc @flip1995 for any imprecision with the component release process, I don't want to lie to anyone :)
Most helpful comment
@rustbot modify labels: -A-style
Okay, seems to work, just had to add rustbot with write permissions to this repo.