-
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
redundant_pattern_matching fixit suggestion fails to apply #4344
Labels
C-bug
Category: Clippy is not doing the correct thing
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
L-suggestion
Lint: Improving, adding or fixing lint suggestions
Comments
matthiaskrgr
added
C-bug
Category: Clippy is not doing the correct thing
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
labels
Aug 6, 2019
I believe this is the same underlying error: fn main() {
let _ = has_flags();
}
fn has_flags() -> bool {
let bla: Result<i32, i32> = Ok(4);
if let Ok(_) = bla {
true
} else {
false
}
} clippy suggests
It seems that clippy replaces the entire span with fn has_flags() -> bool {
let bla: Result<i32, i32> = Ok(4);
if bla.is_ok()
} The code above does not compile for obvious reasons... :/ |
This comment has been minimized.
This comment has been minimized.
phansch
added a commit
to phansch/rust-clippy
that referenced
this issue
Aug 7, 2019
Fixes the problem displayed in rust-lang#4344 (comment). We now append `{}` to the suggestion so that the conditional has the correct syntax again. (If we were to _remove_ the `if` instead, it would trigger the `unused_must_use` warning for `#[must_use]` types.
phansch
added a commit
to phansch/rust-clippy
that referenced
this issue
Aug 8, 2019
Fixes the problem displayed in rust-lang#4344 (comment). We now append `{}` to the suggestion so that the conditional has the correct syntax again. (If we were to _remove_ the `if` instead, it would trigger the `unused_must_use` warning for `#[must_use]` types.
phansch
added a commit
to phansch/rust-clippy
that referenced
this issue
Aug 21, 2019
Fixes the problem displayed in rust-lang#4344 (comment). We now append `{}` to the suggestion so that the conditional has the correct syntax again. (If we were to _remove_ the `if` instead, it would trigger the `unused_must_use` warning for `#[must_use]` types.
The suggestions were improved in #4352, but there is still room for more improvements:
|
bors
added a commit
that referenced
this issue
Aug 21, 2019
Fix some suggestions for redundant_pattern_matching .. and change the Applicability to `MaybeIncorrect`. Fixes the problem displayed in #4344 (comment). We now append `{}` to the suggestion so that the conditional has the correct syntax again. (If we were to _remove_ the `if` instead, it would trigger the `unused_must_use` warning for `#[must_use]` types.) changelog: Fix some suggestions for `redundant_pattern_matching`
phansch
added
the
L-suggestion
Lint: Improving, adding or fixing lint suggestions
label
Aug 24, 2019
Fixed in #5483 |
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
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
L-suggestion
Lint: Improving, adding or fixing lint suggestions
Note: tools are broken since some time now which is why I'm using a fairly outdated version of clippy:
clippy 0.0.212 (c3e9136 2019-07-30)
code:
cargo fix fails to apply clippys suggestion:
If I run
cargo fix -Z unstable-options --clippy
, I get an error:The text was updated successfully, but these errors were encountered: