Skip to content

Clippy practice problems in Rust

Difficulty:
Category:
Tag:

Showing 50 of 68

Status Title Difficulty
A generic Stack, and conditional impl blocks Medium
A macro-generated FFI binding layer Hard
any, all, find, position: audit a list of records Easy
Arc: shared ownership across threads Easy
AsRef, Borrow, and signatures your callers can actually use Medium
Balanced ranges: the arithmetic before the threads Easy
bool and char Easy
Cancel safety, blocking, and locks across `.await` Hard
Capstone: a fully-typed fallible parser Hard
Case-insensitive search without allocating Easy
Countdown futures and the shape of `Pending` Easy
Cow: borrow until you have to own Medium
C strings, ownership across the boundary, and FFI-safe types Medium
Default, #[default] on an enum variant, and ..Default::default() Easy
Deref and the coercion you have been using all along Medium
Deriving traits, and when derive gets the bounds wrong Easy
Designing safe wrappers around unsafe FFI Hard
Designing signatures: T, &T, &mut T, impl Into<T> Medium
Display, Debug, and the ToString blanket impl Easy
Documenting failure: # Errors and # Panics Medium
Eager vs lazy defaults Easy
fold and try_fold: a total that refuses to overflow Medium
From, Into, and your first blanket impl with teeth Medium
Generics, traits and lifetimes in one signature Medium
Hash and the Hash/Eq contract Medium
if let, while let, and let ... else Easy
Implement Iterator by hand: the Collatz sequence Medium
Indexing in a loop is usually a borrow-checker workaround — and clippy knows Medium
`large_enum_variant`: boxing the fat variant Medium
Laziness: prove the pipeline interleaves Easy
Let elision do it Easy
`let _ =` versus `let _x =`: the guard that dies instantly Medium
loop, while, for, and break with a value Easy
Make the lint happy: `'_` in return paths Easy
map, filter, filter_map: parse host:port lines Easy
matches! and the lints that push you toward it Easy
Method receivers and the consuming builder Medium
#[must_use] in depth Medium
One file, one function, one gate Easy
PartialOrd and Ord: derived ordering follows declaration order Medium
Pointer arithmetic: `offset`, `add`, `sub`, `wrapping_*` Medium
`poll_fn`: a future from a closure Easy
Propagating with `?` Easy
`ptr::read`, `write`, `copy`, `copy_nonoverlapping`, `drop_in_place` Medium
Ranges: .., ..=, and range patterns Easy
`Rc<RefCell<T>>`: the workhorse, and when it is a smell Hard
`Rc<str>`: interning without double indirection Medium
Result, and why it is #[must_use] Easy
Result combinators and map_err Easy
Safety comments as a discipline: `// SAFETY:` and `# Safety` Easy