-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Clippy applies wrong fix for useless_vec
for Edition 2021
#111034
Comments
possibly this can be decorated further with a suggestion, seeing as the current implementation is, indeed, correct - the slice seems to be preferable here.
|
Now that |
Fix `useless_vec` suggestion in `for _ in vec![..]` Fixes rust-lang/rust#111034 changelog: [`useless_vec`]: Fix suggestion in `for _ in vec![..]`
I have a wrong fix too, please fix the clippy,thanks! diff --git a/src/operator/mod.rs b/src/operator/mod.rs
index 2b6d6ec..f69838b 100644
--- a/src/operator/mod.rs
+++ b/src/operator/mod.rs
@@ -565,7 +565,7 @@ impl Operator {
fn is_valid_start(id: &str) -> bool {
match id.chars().next() {
- Some(c) => ('a'..='z').contains(&c) || ('A'..='Z').contains(&c),
+ Some(c) => c.is_ascii_lowercase() || c.is_ascii_uppercase(),
None => false,
}
} |
|
I want letter inside [a-zA-Z],no numbers no other characters, however clippy fix as lower/upper case only, how do you call that is right? |
a.is_ascii_lowercase() corresponds to [a-z]. How do you call this incorrect? |
OK, sorry, the |
@sweihub Stop bumping the thread, please. Open your own issue, if you believe that the naming is not right. |
Clippy applies the wrong fix to the following code:
with the error:
It seems that clippy replaced
vec![0, 1]
with&[0, 1]
, which is not correct. For Edition 2021, it should replace it with[0, 1]
instead.The text was updated successfully, but these errors were encountered: