-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
manual_split_once lint causes a change in behaviour #7889
Labels
C-bug
Category: Clippy is not doing the correct thing
good-first-issue
These issues are a good way to get started with Clippy
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Comments
surechen
added a commit
to surechen/rust-clippy
that referenced
this issue
Oct 29, 2021
Change manual_split_once's suggestion ".unwrap().1" after split_once or rsplit_once to .map_or("key=value", |x| x.1) changelog: Change manual_split_once's suggestion ".unwrap().1" after split_once or rsplit_once to .map_or("key=value", |x| x.1)
surechen
added a commit
to surechen/rust-clippy
that referenced
this issue
Oct 30, 2021
Change manual_split_once's suggestion ".unwrap().1" after split_once or rsplit_once to .map_or(.., |x| x.1). changelog: Change manual_split_once's suggestion ".unwrap().1" after split_once or rsplit_once to .map_or(.., |x| x.1).
link2xt
added a commit
to deltachat/deltachat-core-rust
that referenced
this issue
Dec 4, 2021
It's suggestions in stable 1.57 Rust are incorrect: rust-lang/rust-clippy#7889
link2xt
added a commit
to deltachat/deltachat-core-rust
that referenced
this issue
Dec 4, 2021
It's suggestions in stable 1.57 Rust are incorrect: rust-lang/rust-clippy#7889
link2xt
added a commit
to deltachat/deltachat-core-rust
that referenced
this issue
Dec 4, 2021
It's suggestions in stable 1.57 Rust are incorrect: rust-lang/rust-clippy#7889
link2xt
added a commit
to deltachat/deltachat-core-rust
that referenced
this issue
Dec 4, 2021
* Remove unused os_name * Disable clippy::manual_split_once lint It's suggestions in stable 1.57 Rust are incorrect: rust-lang/rust-clippy#7889 * Allow unused fields in OAuth2 response * Fix clippy warning about `select_pk_for_encryption`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: Clippy is not doing the correct thing
good-first-issue
These issues are a good way to get started with Clippy
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Lint name: manual_split_once
I tried this code:
I expected to see this happen:
cargo clippy
should not suggest I change it torsplit_once
as that changes the behaviour.Instead, this happened:
cargo clippy --fix
rewrote this topath.rsplit_once('/').unwrap().1
which is not equivalent code asrsplitn
will always return at least one item, whereasrsplit_once
will returnNone
if the separator does not exist in the string causing the unwrap to panic.path.rsplit_once('/').map_or(path, |t| t.1)
would be a valid transformation.Meta
Rust version (
rustc -Vv
):The text was updated successfully, but these errors were encountered: