-
Notifications
You must be signed in to change notification settings - Fork 6
Clippy files #22
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 files #22
Changes from 2 commits
85f6e7d
eb3deca
6bae511
a6fa7cb
6b30ac4
79d7336
a1d99b5
b1a7e7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[package] | ||
name = "clippy_test" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
fn main() { | ||
let x: Vec<u8> = vec![]; | ||
let y = x.len() == 0; | ||
Comment on lines
+2
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Use - let y = x.len() == 0; + println!("Vector empty: {}", x.is_empty()); 📝 Committable suggestion
Suggested change
let x: Vec<u8> = vec![];
let y = x.len() == 0;
let x: Vec<u8> = vec![];
println!("Vector empty: {}", x.is_empty());
🤖 Prompt for AI Agents
|
||
|
||
let mut a = 5; | ||
a = a; | ||
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Remove redundant self-assignment. The self-assignment let mut a = 5;
- a = a; 📝 Committable suggestion
Suggested change
let mut a = 5;
a = a;
let mut a = 5;
🤖 Prompt for AI Agents
|
||
|
||
let name = String::from("clippy"); | ||
println!("Name: {}", &name[..]); | ||
} | ||
Comment on lines
+1
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Address unused variables to eliminate compiler warnings. The variables For a cleaner demonstration, consider this approach: fn main() { - let x: Vec<u8> = vec![]; - let y = x.len() == 0; - - let mut a = 5; - a = a; - + let x: Vec<u8> = vec![]; + println!("Vector empty: {}", x.is_empty()); + + let mut a = 5; + a += 1; // Meaningful mutation + println!("Value: {}", a); + let name = String::from("clippy"); - println!("Name: {}", &name[..]); + println!("Name: {}", name); } 📝 Committable suggestion
Suggested change
fn main() {
let x: Vec<u8> = vec![];
let y = x.len() == 0;
let mut a = 5;
a = a;
let name = String::from("clippy");
println!("Name: {}", &name[..]);
}
fn main() {
let x: Vec<u8> = vec![];
println!("Vector empty: {}", x.is_empty());
let mut a = 5;
a += 1; // Meaningful mutation
println!("Value: {}", a);
let name = String::from("clippy");
println!("Name: {}", name);
}
🤖 Prompt for AI Agents
|
||
|