Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

single-char-push-str: expand to catch insert_str(n, "x") and suggest insert() #6026

Closed
matthiaskrgr opened this issue Sep 10, 2020 · 0 comments · Fixed by #6037
Closed

single-char-push-str: expand to catch insert_str(n, "x") and suggest insert() #6026

matthiaskrgr opened this issue Sep 10, 2020 · 0 comments · Fixed by #6037
Assignees
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-perf Lint: Belongs in the perf lint group L-style Lint: Belongs in the style lint group

Comments

@matthiaskrgr
Copy link
Member

The single-char-push-str lint looks for single-char &strs added to Strings via push_str() and suggests push().

It should be extended to also catch insert_str(n, "a") with single char args and suggest insert(n, 'a').

@matthiaskrgr matthiaskrgr added C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-style Lint: Belongs in the style lint group L-perf Lint: Belongs in the perf lint group labels Sep 10, 2020
@matthiaskrgr matthiaskrgr self-assigned this Sep 13, 2020
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Sep 13, 2020
…ls and suggest insert()

changelog: add single_char_insert_str lint which lints using string.insert_str() with single char literals and suggests string.insert() with a char

Fixes rust-lang#6026
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Sep 13, 2020
…ls and suggest insert()

changelog: add single_char_insert_str lint which lints using string.insert_str() with single char literals and suggests string.insert() with a char

Fixes rust-lang#6026
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Sep 24, 2020
…and suggest insert()

changelog: single_char_push_str: lint using string.insert_str() with single char literals and suggests string.insert() with a char

Fixes rust-lang#6026
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Sep 24, 2020
…and suggest insert()

changelog: single_char_push_str: lint using string.insert_str() with single char literals and suggests string.insert() with a char

Fixes rust-lang#6026
ebroto pushed a commit to matthiaskrgr/rust-clippy that referenced this issue Oct 7, 2020
…and suggest insert()

changelog: single_char_push_str: lint using string.insert_str() with single char literals and suggests string.insert() with a char

Fixes rust-lang#6026
bors added a commit that referenced this issue Nov 3, 2020
single_char_insert_str: lint using insert_str() on single-char literals and suggest insert()

Fixes #6026

changelog: add single_char_insert_str lint which lints using string.insert_str() with single char literals and suggests string.insert() with a char
@bors bors closed this as completed in 2350ee7 Nov 3, 2020
Ryan1729 pushed a commit to Ryan1729/rust-clippy that referenced this issue Nov 7, 2020
…and suggest insert()

changelog: single_char_push_str: lint using string.insert_str() with single char literals and suggests string.insert() with a char

Fixes rust-lang#6026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-perf Lint: Belongs in the perf lint group L-style Lint: Belongs in the style lint group
Projects
None yet
1 participant