Skip to content

Commit 54116cb

Browse files
r test
1 parent 5fbf32a commit 54116cb

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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]

example.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
}

0 commit comments

Comments
 (0)