File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ [package]
3+ name = "example_project"
4+ version = "0.1.0"
5+ edition = "2021"
6+
7+ [[bin]]
8+ name = "example"
9+ path = "example.rs"
10+
11+ [dependencies]
Original file line number Diff line number Diff line change 1+ fn main() {
2+ // Unnecessary clone
3+ let x = String::from("hello");
4+ let y = x.clone(); // Clippy will warn here about the unnecessary clone
5+ println!("{}", y);
6+
7+ // Unused variable
8+ let unused_var = 42; // Clippy will warn about this
9+
10+ // Possible panic on unwrap
11+ let result: Result<i32, &str> = Err("error");
12+ let value = result.unwrap(); // Clippy will warn about this
13+
14+ // Redundant reference
15+ let z = &y; // Clippy might suggest removing the reference here
16+ println!("{}", z);
17+
18+ // Inefficient `for` loop
19+ let vec = vec![1, 2, 3, 4];
20+ for i in vec.iter() { // Clippy may suggest using a `for` loop by value
21+ println!("{}", i);
22+ }
23+
24+ // Excessive type annotation
25+ let a: i32 = 5; // Clippy will suggest removing the type annotation since it's obvious
26+
27+ // Missing documentation
28+ let un_documented_function = |x: i32| x * 2; // Clippy may warn about missing documentation
29+ }
You can’t perform that action at this time.
0 commit comments