Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Reviews RTK Rust code for idiomatic simplifications like iterator chains and string building while preserving behavior and constraints.
Use this skill ↓65% 83%+17 ptsof test cases passed
Passed 19 of 23 test cases with the skill, and 15 of 23 without it.
3 of 3 safety checks passed
Not used yet
Review and simplify Rust code in RTK while respecting the project's constraints.
LazyLock regex — cannot be moved inside functions even if "simpler".context() on every ? — verbose but mandatoryOk(())#[cfg(test)] mod tests — never remove test modules// ❌ Verbose
let mut result = Vec::new();
for line in input.lines() {
let trimmed = line.trim();
if !trimmed.is_empty() && trimmed.starts_with("error") {
result.push(trimmed.to_string());
}
}
// ✅ Idiomatic
let result: Vec<String> = input.lines()
.map(|l| l.trim())
.filter(|l| !l.is_empty() && l.starts_with("error"))
.map(str::to_string)
.collect();
// ❌ Verbose push loop
let mut out = String::new();
for (i, line) in lines.iter().enumerate() {
Next to this one in the catalogue, plus more from the same author.