Skip to content

Commit

Permalink
chore: clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Devin-Yeung committed Nov 10, 2024
1 parent 41b2d97 commit 9b075cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/grammar/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl<'rule> GrammarGraph<'rule> {
return Err(Error::TrapLoop { spans });
}
}
Ok(&self)
Ok(self)
}

fn is_trap_loop(&self, scc: &Vec<NodeIndex>) -> bool {

Check warning on line 62 in src/grammar/graph.rs

View workflow job for this annotation

GitHub Actions / clippy

writing `&Vec` instead of `&[_]` involves a new object where a slice will do

warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do --> src/grammar/graph.rs:62:33 | 62 | fn is_trap_loop(&self, scc: &Vec<NodeIndex>) -> bool { | ^^^^^^^^^^^^^^^ help: change this to: `&[NodeIndex]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg = note: `#[warn(clippy::ptr_arg)]` on by default
Expand All @@ -73,9 +73,8 @@ impl<'rule> GrammarGraph<'rule> {
}
let out_deg: HashSet<NodeIndex> = scc
.iter()
.map(|nx| self.graph.neighbors(*nx))
.flatten()
.flat_map(|nx| self.graph.neighbors(*nx))
.collect();
out_deg == scc.iter().map(|n| *n).collect()
out_deg == scc.iter().copied().collect()
}
}
4 changes: 2 additions & 2 deletions src/grammar/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ impl RawGrammar {
.rules
.iter()
.map(|rule| {
let entry = (rule.name.clone(), graph.add_node(rule.name.clone()));
entry

(rule.name.clone(), graph.add_node(rule.name.clone()))
})
.collect();
// setup the graph
Expand Down

0 comments on commit 9b075cb

Please sign in to comment.