DeepSource
Dashboard Resources Pricing Discover Directory Log in

Run your first analysis.

Find thousands of code security and quality issues in your codebase, before they end up in production.

Start now
All analyzers Rust
Rust

Rust

By DeepSource

Use Analyzer
Docs
Discuss
Found empty loop expression RS-P1000
Performance

These busy loops burn CPU cycles without doing anything. It is almost always a better idea to panic! than to have a busy loop.

Found occurrence of .bytes().count() RS-P1001
Performance

.bytes().count() is better written as .len() which is easier to read and more performant.

Found occurrence of .bytes().nth(..) RS-P1002
Performance

.bytes().nth(..) is better written as .as_bytes().get(..) which is more performant.

Found occurrence of Arc<RwLock<HashMap<K, V>>> RS-P1003
Performance

Arc<RwLock<HashMap<K, V>>> has performance concerns, the dashmap crate provides a much better alternative to concurrent hashmaps. Hence, Arc<RwLock<HashMap<K, V>>> is better off replaced by Arc<DashMap<K, V>> from the dashmap crate.

Found call to .trim() followed by .split_whitespace() RS-P1005
Performance

.split_whitespace() produces an iterator with preceding and trailing whitespace removed. Thus, s.trim().split_whitespace() is equivalent to just s.split_whitespace().