Applied bind limit of 1000 in correct place #36
Annotations
3 errors and 147 warnings
redundant redefinition of a binding `c`:
src/machine.rs#L298
error: redundant redefinition of a binding `c`
--> src/machine.rs:298:33
|
298 | ... let c = c;
| ^^^^^^^^^^
|
help: `c` is initially defined here
--> src/machine.rs:297:41
|
297 | ... if let Some(c) = self.color {
| ^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals
= note: `#[deny(clippy::redundant_locals)]` on by default
|
this comparison involving the minimum or maximum element for this type contains a case that is always true or always false:
src/machine.rs#L167
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> src/machine.rs:167:16
|
167 | if self.bind_limit <= 0 {
| ^^^^^^^^^^^^^^^^^^^^
|
= help: because `0` is the minimum value for this type, the case where the two sides are not equal never occurs, consider using `self.bind_limit == 0` instead
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#absurd_extreme_comparisons
= note: `#[deny(clippy::absurd_extreme_comparisons)]` on by default
|
build
Clippy had exited with the 101 exit code
|
useless use of `vec!`:
src/multipattern.rs#L69
warning: useless use of `vec!`
--> src/multipattern.rs:69:80
|
69 | let program = machine::Program::compile_from_multi_pat(&asts, &vec![], &vec![]);
| ^^^^^^^ help: you can use a slice directly: `&[]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
= note: `#[warn(clippy::useless_vec)]` on by default
|
unnecessary closure used with `bool::then`:
src/multipattern.rs#L189
warning: unnecessary closure used with `bool::then`
--> src/multipattern.rs:189:9
|
189 | (!matches.matches.is_empty()).then(|| matches)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------
| |
| help: use `then_some(..)` instead: `then_some(matches)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
all variants have the same postfix: `Error`:
src/multipattern.rs#L97
warning: all variants have the same postfix: `Error`
--> src/multipattern.rs:97:1
|
97 | / pub enum MultiPatternParseError<E> {
98 | | /// One of the patterns in the multipattern failed to parse.
99 | | #[error(transparent)]
100 | | PatternParseError(E),
... |
106 | | VariableError(<Var as FromStr>::Err),
107 | | }
| |_^
|
= help: remove the postfixes and use full paths to the variants instead of glob imports
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names
= note: `#[warn(clippy::enum_variant_names)]` on by default
|
length comparison to zero:
src/multipattern.rs#L85
warning: length comparison to zero
--> src/multipattern.rs:85:16
|
85 | if p2_holes.len() == 0 {
| ^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `p2_holes.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
|
length comparison to zero:
src/multipattern.rs#L81
warning: length comparison to zero
--> src/multipattern.rs:81:16
|
81 | if p_holes.len() == 0 {
| ^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `p_holes.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
|
deref which would be done by auto-deref:
src/colored_union_find.rs#L187
warning: deref which would be done by auto-deref
--> src/colored_union_find.rs:187:37
|
187 | .filter(|k| load_id(*k) as usize == t_i)
| ^^ help: try: `k`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
= note: `#[warn(clippy::explicit_auto_deref)]` on by default
|
unneeded `return` statement:
src/colored_union_find.rs#L167
warning: unneeded `return` statement
--> src/colored_union_find.rs:167:9
|
167 | return Some((*x_res, *y_res));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
167 - return Some((*x_res, *y_res));
167 + Some((*x_res, *y_res))
|
|
called `map(..).flatten()` on `Option`:
src/colored_union_find.rs#L147
warning: called `map(..).flatten()` on `Option`
--> src/colored_union_find.rs:147:14
|
147 | .map(|x| self.translation.get_by_right(&x)).flatten().copied()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|x| self.translation.get_by_right(&x))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
|
redundant closure:
src/colored_union_find.rs#L97
warning: redundant closure
--> src/colored_union_find.rs:97:46
|
97 | parents: parents.into_iter().map(|x| AtomicU32::new(x)).collect(),
| ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `AtomicU32::new`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
|
unneeded `return` statement:
src/tools.rs#L45
warning: unneeded `return` statement
--> src/tools.rs:45:9
|
45 | return res;
| ^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
45 - return res;
45 + res
|
|
module has the same name as its containing module:
src/tools.rs#L1
warning: module has the same name as its containing module
--> src/tools.rs:1:1
|
1 | / pub mod tools {
2 | | use std::collections::hash_map::RandomState;
3 | | use std::hash::Hash;
... |
109 | | }
110 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_inception
= note: `#[warn(clippy::module_inception)]` on by default
|
question mark operator is useless here:
src/eggstentions/tree.rs#L170
warning: question mark operator is useless here
--> src/eggstentions/tree.rs:170:9
|
170 | Ok(parse_sexp_tree(&sexp)?)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing question mark and `Ok()`: `parse_sexp_tree(&sexp)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
= note: `#[warn(clippy::needless_question_mark)]` on by default
|
unnecessary closure used with `bool::then`:
src/eggstentions/tree.rs#L110
warning: unnecessary closure used with `bool::then`
--> src/eggstentions/tree.rs:110:25
|
110 | rec_res.is_eq().then(|| rec_res)
| ^^^^^^^^^^^^^^^^----------------
| |
| help: use `then_some(..)` instead: `then_some(rec_res)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
methods called `into_*` usually take `self` by value:
src/eggstentions/expression_ops.rs#L116
warning: methods called `into_*` usually take `self` by value
--> src/eggstentions/expression_ops.rs:116:18
|
116 | fn into_tree(&'a self) -> RecExpSlice<'a, T>;
| ^^^^^^^^
|
= help: consider choosing a less ambiguous name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
= note: `#[warn(clippy::wrong_self_convention)]` on by default
|
an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true:
src/eggstentions/expression_ops.rs#L107
warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
--> src/eggstentions/expression_ops.rs:107:1
|
107 | impl<'a, L: Language> Into<RecExpr<L>> for RecExpSlice<'a, L> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
help: replace the `Into` implementation with `From<eggstentions::expression_ops::RecExpSlice<'a, L>>`
|
107 ~ impl<'a, L: Language> From<RecExpSlice<'a, L>> for RecExpr<L> {
108 ~ fn from(val: RecExpSlice<'a, L>) -> Self {
109 ~ RecExpr::from(val.exp.as_ref()[..val.index + 1].iter().cloned().collect_vec())
|
|
you seem to be trying to pop elements from a `Vec` in a loop:
src/eggstentions/expression_ops.rs#L91
warning: you seem to be trying to pop elements from a `Vec` in a loop
--> src/eggstentions/expression_ops.rs:91:13
|
91 | let current = nodes.pop().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_while_let_some
help: consider using a `while..let` loop
|
90 ~ while let Some(current) = nodes.pop() {
91 ~
|
|
the following explicit lifetimes could be elided: 'a:
src/eggstentions/expression_ops.rs#L49
warning: the following explicit lifetimes could be elided: 'a
--> src/eggstentions/expression_ops.rs:49:23
|
49 | fn add_to_exp<'a, L: Language>(expr: &mut Vec<L>, child: &RecExpSlice<'a, L>) -> Id {
| ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
49 - fn add_to_exp<'a, L: Language>(expr: &mut Vec<L>, child: &RecExpSlice<'a, L>) -> Id {
49 + fn add_to_exp<L: Language>(expr: &mut Vec<L>, child: &RecExpSlice<'_, L>) -> Id {
|
|
`to_string` applied to a type that implements `Display` in `format!` args:
src/eggstentions/expression_ops.rs#L42
warning: `to_string` applied to a type that implements `Display` in `format!` args
--> src/eggstentions/expression_ops.rs:42:56
|
42 | format!("({} {})", self.root().display_op().to_string(),
| ^^^^^^^^^^^^ help: remove this
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
|
`to_string` applied to a type that implements `Display` in `format!` args:
src/eggstentions/expression_ops.rs#L40
warning: `to_string` applied to a type that implements `Display` in `format!` args
--> src/eggstentions/expression_ops.rs:40:51
|
40 | format!("{}", self.root().display_op().to_string())
| ^^^^^^^^^^^^ help: remove this
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
|
useless use of `format!`:
src/eggstentions/expression_ops.rs#L40
warning: useless use of `format!`
--> src/eggstentions/expression_ops.rs:40:13
|
40 | format!("{}", self.root().display_op().to_string())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `self.root().display_op().to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
= note: `#[warn(clippy::useless_format)]` on by default
|
non-canonical implementation of `partial_cmp` on an `Ord` type:
src/eggstentions/costs.rs#L37
warning: non-canonical implementation of `partial_cmp` on an `Ord` type
--> src/eggstentions/costs.rs:37:1
|
37 | / impl PartialOrd for RepOrder {
38 | | fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
| | _____________________________________________________________-
39 | || match self.size.partial_cmp(&other.size) {
40 | || None => { other.compare_vars(self) }
41 | || Some(x) => {
... ||
48 | || }
49 | || }
| ||_____- help: change this to: `{ Some(self.cmp(other)) }`
50 | | }
| |__^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#non_canonical_partial_ord_impl
= note: `#[warn(clippy::non_canonical_partial_ord_impl)]` on by default
|
writing `&Vec` instead of `&[_]` involves a new object where a slice will do:
src/eggstentions/costs.rs#L20
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> src/eggstentions/costs.rs:20:22
|
20 | fn count_ph1(it: &Vec<String>) -> usize {
| ^^^^^^^^^^^^ help: change this to: `&[String]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
|
called `unwrap` on `color` after checking its variant with `is_some`:
src/eggstentions/reconstruct.rs#L110
warning: called `unwrap` on `color` after checking its variant with `is_some`
--> src/eggstentions/reconstruct.rs:110:41
|
109 | let fixed_n = if color.is_some() {
| ------------------ help: try: `if let Some(..) = &color`
110 | graph.colored_canonize(*color.as_ref().unwrap(), n)
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap
|
called `map(..).flatten()` on `Option`:
src/eggstentions/reconstruct.rs#L80
warning: called `map(..).flatten()` on `Option`
--> src/eggstentions/reconstruct.rs:80:19
|
80 | color.map(|c_id|
| ___________________^
81 | | graph.get_color(c_id).map(|x|
82 | | x.equality_class(graph, *c).find_map(|id|
83 | | // Build translation is only called when a translation exists
84 | | translations.get(&id))))
85 | | .flatten().flatten()
| |__________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
help: try replacing `map` with `and_then` and remove the `.flatten()`
|
80 ~ color.and_then(|c_id|
81 + graph.get_color(c_id).map(|x|
82 + x.equality_class(graph, *c).find_map(|id|
83 + // Build translation is only called when a translation exists
84 ~ translations.get(&id)))).flatten()
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/eggstentions/reconstruct.rs#L70
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/eggstentions/reconstruct.rs:70:24
|
70 | inner_ids.push(&edge);
| ^^^^^ help: change this to: `edge`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/eggstentions/reconstruct.rs#L67
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/eggstentions/reconstruct.rs:67:59
|
67 | build_translation(graph, color, translations, &edge, class);
| ^^^^^ help: change this to: `edge`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/eggstentions/reconstruct.rs#L58
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/eggstentions/reconstruct.rs:58:59
|
58 | build_translation(graph, color, translations, &edge, class);
| ^^^^^ help: change this to: `edge`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
called `is_some()` after searching an `Iterator` with `find`:
src/eggstentions/reconstruct.rs#L57
warning: called `is_some()` after searching an `Iterator` with `find`
--> src/eggstentions/reconstruct.rs:57:48
|
57 | x.equality_class(graph, class).find(|id| translations.contains_key(id)).is_some()))) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|id| translations.contains_key(&id))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/eggstentions/reconstruct.rs#L45
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/eggstentions/reconstruct.rs:45:77
|
45 | check_class(graph, color, id, translations, &mut inner_ids, &colorded_class)
| ^^^^^^^^^^^^^^^ help: change this to: `colorded_class`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`:
src/eggstentions/reconstruct.rs#L40
warning: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> src/eggstentions/reconstruct.rs:40:5
|
40 | // color.map(|c| {
41 | || if let Some(x) = graph.get_color(c) {
42 | || let ids = x.equality_class(graph, class);
43 | || for id in ids {
... ||
47 | || }
48 | || });
| ||______^- help: try: `if let Some(c) = color { ... }`
| |______|
|
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
= note: `#[warn(clippy::option_map_unit_fn)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/eggstentions/reconstruct.rs#L39
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/eggstentions/reconstruct.rs:39:68
|
39 | check_class(graph, color, class, translations, &mut inner_ids, &cur_class);
| ^^^^^^^^^^ help: change this to: `cur_class`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
you are using an explicit closure for cloning elements:
src/eggstentions/reconstruct.rs#L29
warning: you are using an explicit closure for cloning elements
--> src/eggstentions/reconstruct.rs:29:5
|
29 | translations.get(&class).map(|x| x.clone())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `translations.get(&class).cloned()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/eggstentions/reconstruct.rs#L26
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/eggstentions/reconstruct.rs:26:27
|
26 | reconstruct_inner(&graph, *child, max_depth - 1, None, &mut translations);
| ^^^^^^ help: change this to: `graph`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
you are using an explicit closure for cloning elements:
src/eggstentions/reconstruct.rs#L19
warning: you are using an explicit closure for cloning elements
--> src/eggstentions/reconstruct.rs:19:5
|
19 | translations.get(&class).map(|x| x.clone())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `translations.get(&class).cloned()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
= note: `#[warn(clippy::map_clone)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/eggstentions/reconstruct.rs#L18
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/eggstentions/reconstruct.rs:18:23
|
18 | reconstruct_inner(&graph, class, max_depth, color, &mut translations);
| ^^^^^^ help: change this to: `graph`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
unneeded `return` statement:
src/colors.rs#L250
warning: unneeded `return` statement
--> src/colors.rs:250:9
|
250 | return res.into_iter().collect_vec();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
250 - return res.into_iter().collect_vec();
250 + res.into_iter().collect_vec()
|
|
useless conversion to the same type: `indexmap::map::Keys<'_, Id, indexmap::IndexSet<Id>>`:
src/colors.rs#L236
warning: useless conversion to the same type: `indexmap::map::Keys<'_, Id, indexmap::IndexSet<Id>>`
--> src/colors.rs:236:9
|
236 | self.equality_classes.keys().into_iter()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `self.equality_classes.keys()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `#[warn(clippy::useless_conversion)]` on by default
|
unneeded `return` statement:
src/colors.rs#L193
warning: unneeded `return` statement
--> src/colors.rs:193:9
|
193 | return Default::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
193 - return Default::default();
193 + Default::default()
|
|
unnecessary closure used to substitute value for `Option::None`:
src/colors.rs#L88
warning: unnecessary closure used to substitute value for `Option::None`
--> src/colors.rs:88:9
|
88 | / self.union_find.find(&fixed).unwrap_or_else(|| {
89 | | fixed
90 | | })
| |__________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
= note: `#[warn(clippy::unnecessary_lazy_evaluations)]` on by default
help: use `unwrap_or(..)` instead
|
88 ~ self.union_find.find(&fixed).unwrap_or({
89 + fixed
90 + })
|
|
redundant closure:
src/colors.rs#L45
warning: redundant closure
--> src/colors.rs:45:42
|
45 | let parents = parent.map_or_else(|| vec![], |p| {
| ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
|
casting to the same type is unnecessary (`f64` -> `f64`):
src/test.rs#L25
warning: casting to the same type is unnecessary (`f64` -> `f64`)
--> src/test.rs:25:35
|
25 | let diff = mean - (*value as f64);
| ^^^^^^^^^^^^^^^ help: try: `{ *value }`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
|
casting to the same type is unnecessary (`usize` -> `usize`):
src/lib.rs#L95
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> src/lib.rs:95:9
|
95 | id.0 as usize
| ^^^^^^^^^^^^^ help: try: `id.0`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
|
casting to the same type is unnecessary (`usize` -> `usize`):
src/lib.rs#L89
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> src/lib.rs:89:17
|
89 | ColorId(n as usize)
| ^^^^^^^^^^ help: try: `n`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
|
an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true:
src/lib.rs#L69
warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
--> src/lib.rs:69:1
|
69 | impl Into<Id> for i32 {
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
help: replace the `Into` implementation with `From<i32>`
|
69 ~ impl From<i32> for Id {
70 ~ fn from(val: i32) -> Self {
71 ~ Id(val as u32)
|
|
an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true:
src/lib.rs#L63
warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
--> src/lib.rs:63:1
|
63 | impl Into<Id> for u32 {
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
= note: `#[warn(clippy::from_over_into)]` on by default
help: replace the `Into` implementation with `From<u32>`
|
63 ~ impl From<u32> for Id {
64 ~ fn from(val: u32) -> Self {
65 ~ Id(val)
|
|
called `is_none()` after searching an `Iterator` with `find`:
src/util.rs#L128
warning: called `is_none()` after searching an `Iterator` with `find`
--> src/util.rs:128:29
|
128 | assert!(strings.values().find(|&&v| v == name).is_none());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!strings.values().any(|&v| v == name)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/unionfind.rs#L174
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/unionfind.rs:174:42
|
174 | let idx = *self.trns.get_by_left(&key)?;
| ^^^^ help: change this to: `key`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/unionfind.rs#L168
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/unionfind.rs:168:42
|
168 | let idx = *self.trns.get_by_left(&key)?;
| ^^^^ help: change this to: `key`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/unionfind.rs#L149
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/unionfind.rs:149:47
|
149 | let mut idx2 = *self.trns.get_by_left(&key2)?;
| ^^^^^ help: change this to: `key2`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/unionfind.rs#L148
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/unionfind.rs:148:47
|
148 | let mut idx1 = *self.trns.get_by_left(&key1)?;
| ^^^^^ help: change this to: `key1`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/unionfind.rs#L132
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/unionfind.rs:132:56
|
132 | assert!(res.is_some() || self.trns.get_by_left(&key).is_none());
| ^^^^ help: change this to: `key`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/unionfind.rs#L130
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/unionfind.rs:130:41
|
130 | let idx = self.trns.get_by_left(&key)?;
| ^^^^ help: change this to: `key`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/unionfind.rs#L125
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/unionfind.rs:125:56
|
125 | assert!(res.is_some() || self.trns.get_by_left(&key).is_none());
| ^^^^ help: change this to: `key`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/unionfind.rs#L123
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/unionfind.rs:123:41
|
123 | let res = self.trns.get_by_left(&key)
| ^^^^ help: change this to: `key`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
using `clone` on type `Option<ColorId>` which implements the `Copy` trait:
src/subst.rs#L118
warning: using `clone` on type `Option<ColorId>` which implements the `Copy` trait
--> src/subst.rs:118:25
|
118 | new.color = sub2.color.clone();
| ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `sub2.color`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
|
the following explicit lifetimes could be elided: 'a:
src/ser.rs#L160
warning: the following explicit lifetimes could be elided: 'a
--> src/ser.rs:160:29
|
160 | pub(crate) fn add_class<'a>(&'a mut self, id: Id) {
| ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
160 - pub(crate) fn add_class<'a>(&'a mut self, id: Id) {
160 + pub(crate) fn add_class(&mut self, id: Id) {
|
|
length comparison to zero:
src/ser.rs#L144
warning: length comparison to zero
--> src/ser.rs:144:25
|
144 | .filter(|s| s.len() > 0)
| ^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!s.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
|
length comparison to zero:
src/ser.rs#L91
warning: length comparison to zero
--> src/ser.rs:91:48
|
91 | let v: Vec<_> = line.split(' ').filter(|s| s.len() > 0).collect();
| ^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!s.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
|
redundant closure:
src/run.rs#L1011
warning: redundant closure
--> src/run.rs:1011:45
|
1011 | matches.resize_with(rewrites.len(), || Default::default());
| ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `Default::default`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
|
the following explicit lifetimes could be elided: 'a:
src/run.rs#L984
warning: the following explicit lifetimes could be elided: 'a
--> src/run.rs:984:24
|
984 | fn search_rewrites<'a, 'b>(&mut self, iteration: usize, egraph: &EGraph<L, N>, rewrites: &[&'a Rewrite<L, N>], matches: &mut Vec<Opti...
| ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
984 - fn search_rewrites<'a, 'b>(&mut self, iteration: usize, egraph: &EGraph<L, N>, rewrites: &[&'a Rewrite<L, N>], matches: &mut Vec<Option<SearchMatches>>, start_time: Instant, time_limit: Duration) -> RunnerResult<()> {
984 + fn search_rewrites<'b>(&mut self, iteration: usize, egraph: &EGraph<L, N>, rewrites: &[&Rewrite<L, N>], matches: &mut Vec<Option<SearchMatches>>, start_time: Instant, time_limit: Duration) -> RunnerResult<()> {
|
|
the following explicit lifetimes could be elided: 'a:
src/run.rs#L975
warning: the following explicit lifetimes could be elided: 'a
--> src/run.rs:975:23
|
975 | fn search_rewrite<'a>(
| ^^
...
979 | rewrite: &'a Rewrite<L, N>,
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
975 ~ fn search_rewrite(
976 | &mut self,
977 | iteration: usize,
978 | egraph: &EGraph<L, N>,
979 ~ rewrite: &Rewrite<L, N>,
|
|
redundant closure:
src/run.rs#L928
warning: redundant closure
--> src/run.rs:928:45
|
928 | matches.resize_with(rewrites.len(), || Default::default());
| ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `Default::default`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
= note: `#[warn(clippy::redundant_closure)]` on by default
|
called `unwrap` on `results` after checking its variant with `is_some`:
src/run.rs#L917
warning: called `unwrap` on `results` after checking its variant with `is_some`
--> src/run.rs:917:36
|
916 | if results.is_some() {
| -------------------- help: try: `if let Some(..) = results`
917 | channel.0.send((i, results.unwrap())).expect("Channel should be big enough for all messages");
| ^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap
= note: `#[warn(clippy::unnecessary_unwrap)]` on by default
|
the following explicit lifetimes could be elided: 'a:
src/run.rs#L897
warning: the following explicit lifetimes could be elided: 'a
--> src/run.rs:897:24
|
897 | fn search_rewrites<'a, 'b>(
| ^^
...
901 | rewrites: &[&'a Rewrite<L, N>],
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
897 ~ fn search_rewrites<'b>(
898 | &mut self,
899 | iteration: usize,
900 | egraph: &EGraph<L, N>,
901 ~ rewrites: &[&Rewrite<L, N>],
|
|
the following explicit lifetimes could be elided: 'a:
src/run.rs#L874
warning: the following explicit lifetimes could be elided: 'a
--> src/run.rs:874:23
|
874 | fn search_rewrite<'a>(
| ^^
...
878 | rewrite: &'a Rewrite<L, N>,
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
874 ~ fn search_rewrite(
875 | &mut self,
876 | iteration: usize,
877 | egraph: &EGraph<L, N>,
878 ~ rewrite: &Rewrite<L, N>,
|
|
the following explicit lifetimes could be elided: 'a:
src/run.rs#L776
warning: the following explicit lifetimes could be elided: 'a
--> src/run.rs:776:30
|
776 | pub fn search_with_stats<'a, L: Language, N: Analysis<L> + 'static>(
| ^^
...
779 | rewrite: &'a Rewrite<L, N>,
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
776 ~ pub fn search_with_stats<L: Language, N: Analysis<L> + 'static>(
777 | iteration: usize,
778 | egraph: &EGraph<L, N>,
779 ~ rewrite: &Rewrite<L, N>,
|
|
this lifetime isn't used in the function definition:
src/run.rs#L629
warning: this lifetime isn't used in the function definition
--> src/run.rs:629:28
|
629 | fn search_rewrites<'a, 'b>(
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
|
the following explicit lifetimes could be elided: 'a:
src/run.rs#L629
warning: the following explicit lifetimes could be elided: 'a
--> src/run.rs:629:24
|
629 | fn search_rewrites<'a, 'b>(
| ^^
...
633 | rewrites: &[&'a Rewrite<L, N>],
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
629 ~ fn search_rewrites<'b>(
630 | &mut self,
631 | iteration: usize,
632 | egraph: &EGraph<L, N>,
633 ~ rewrites: &[&Rewrite<L, N>],
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/run.rs#L534
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/run.rs:534:34
|
534 | data: IterData::make(&self),
| ^^^^^ help: change this to: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this let-binding has unit value:
src/run.rs#L507
warning: this let-binding has unit value
--> src/run.rs:507:9
|
507 | let n_rebuilds = self.egraph.rebuild();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `self.egraph.rebuild();`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
= note: `#[warn(clippy::let_unit_value)]` on by default
|
use of `default` to create a unit struct:
src/run.rs#L259
warning: use of `default` to create a unit struct
--> src/run.rs:259:48
|
259 | scheduler: Box::new(SimpleScheduler::default()),
| ^^^^^^^^^^^ help: remove this call to `default`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs
= note: `#[warn(clippy::default_constructed_unit_structs)]` on by default
|
returning the result of a `let` binding from a block:
src/pattern.rs#L328
warning: returning the result of a `let` binding from a block
--> src/pattern.rs:328:9
|
327 | let sms = SearchMatches { matches };
| ------------------------------------ unnecessary `let` binding
328 | sms
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
help: return the expression directly
|
327 ~
328 ~ SearchMatches { matches }
|
|
struct `SearchMatches` has a public `len` method, but no `is_empty` method:
src/pattern.rs#L295
warning: struct `SearchMatches` has a public `len` method, but no `is_empty` method
--> src/pattern.rs:295:5
|
295 | pub fn len(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
= note: `#[warn(clippy::len_without_is_empty)]` on by default
|
called `map(..).flatten()` on `Iterator`:
src/pattern.rs#L292
warning: called `map(..).flatten()` on `Iterator`
--> src/pattern.rs:292:31
|
292 | self.matches.values().map(|s| s.iter()).flatten()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|s| s.iter())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
= note: `#[warn(clippy::map_flatten)]` on by default
|
this lifetime isn't used in the impl:
src/pattern.rs#L229
warning: this lifetime isn't used in the impl
--> src/pattern.rs:229:6
|
229 | impl<'a, L: Language> From<PatternAst<L>> for Pattern<L> {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
= note: `#[warn(clippy::extra_unused_lifetimes)]` on by default
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`:
src/machine.rs#L649
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> src/machine.rs:649:45
|
649 | let mut not_patterns = not_patterns.into_iter().map(|(not_v, not_p)| {
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec`:
src/machine.rs#L636
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec`
--> src/machine.rs:636:39
|
636 | let or_patterns = or_patterns.into_iter().map(|(or_v, or_ps)| {
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
|
using `clone` on type `Option<ColorId>` which implements the `Copy` trait:
src/machine.rs#L399
warning: using `clone` on type `Option<ColorId>` which implements the `Copy` trait
--> src/machine.rs:399:60
|
399 | return Some(Subst { vec: subst_vec, color: self.color.clone() });
| ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.color`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`:
src/machine.rs#L376
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> src/machine.rs:376:50
|
376 | ... .into_iter()
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
|
using `clone` on type `Option<ColorId>` which implements the `Copy` trait:
src/machine.rs#L367
warning: using `clone` on type `Option<ColorId>` which implements the `Copy` trait
--> src/machine.rs:367:63
|
367 | ... done.borrow_mut().insert((s.color.clone(), *s.get(*root).unwrap()));
| ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `s.color`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
|
using `clone` on type `Option<ColorId>` which implements the `Copy` trait:
src/machine.rs#L348
warning: using `clone` on type `Option<ColorId>` which implements the `Copy` trait
--> src/machine.rs:348:57
|
348 | ... if done.borrow().contains(&(machine.color.clone(), id)) || done.borrow().contains(&(None, id)) {
| ^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `machine.color`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
|
very complex type used. Consider factoring parts into `type` definitions:
src/machine.rs#L340
warning: very complex type used. Consider factoring parts into `type` definitions
--> src/machine.rs:340:35
|
340 | let done: Rc<RefCell<BTreeSet<(Option<ColorId>, Id)>>> = Default::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/extract.rs#L240
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/extract.rs:240:42
|
240 | Some(self.cost_function.cost(&node, cost_f))
| ^^^^^ help: change this to: `node`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/extract.rs#L166
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/extract.rs:166:45
|
166 | (Some(a), Some(b)) => a.partial_cmp(&b).unwrap(),
| ^^ help: change this to: `b`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/egraph.rs#L2227
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/egraph.rs:2227:36
|
2227 | .map(|n| N::make(self, &n))
| ^^ help: change this to: `n`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`:
src/egraph.rs#L2037
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> src/egraph.rs:2037:58
|
2037 | let mut res = self.get_colors_parents(c).into_iter().copied().collect_vec();
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`:
src/egraph.rs#L2004
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> src/egraph.rs:2004:58
|
2004 | let mut res = self.get_colors_parents(c).into_iter().copied().collect_vec();
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
|
this block may be rewritten with the `?` operator:
src/egraph.rs#L1976
warning: this block may be rewritten with the `?` operator
--> src/egraph.rs:1976:9
|
1976 | / if colors.is_none() {
1977 | | return None;
1978 | | }
| |_________^ help: replace it with: `colors?;`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
= note: `#[warn(clippy::question_mark)]` on by default
|
unneeded `return` statement:
src/egraph.rs#L1995
warning: unneeded `return` statement
--> src/egraph.rs:1995:9
|
1995 | / return Some(Box::new(colored_eqs.into_iter()
1996 | | .flat_map(|(c, ids)| ids.into_iter().map(move |id| (c, id)))));
| |__________________________________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
1995 ~ Some(Box::new(colored_eqs.into_iter()
1996 ~ .flat_map(|(c, ids)| ids.into_iter().map(move |id| (c, id)))))
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/egraph.rs#L1940
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/egraph.rs:1940:49
|
1940 | self.get_color(color).unwrap().find(&self, id)
| ^^^^^ help: change this to: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/egraph.rs#L1935
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/egraph.rs:1935:45
|
1935 | self.get_color(color).unwrap().find(&self, id)
| ^^^^^ help: change this to: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`:
src/egraph.rs#L1909
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> src/egraph.rs:1909:76
|
1909 | let color_children = self.get_color(color).unwrap().children().into_iter().copied().collect_vec();
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
|
replacing an `Option` with `None`:
src/egraph.rs#L1847
warning: replacing an `Option` with `None`
--> src/egraph.rs:1847:25
|
1847 | let class = std::mem::replace(&mut self.classes[black.0 as usize], None).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `self.classes[black.0 as usize].take()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_option_with_none
|
replacing an `Option` with `None`:
src/egraph.rs#L1845
warning: replacing an `Option` with `None`
--> src/egraph.rs:1845:21
|
1845 | let color = std::mem::replace(&mut self.colors[c_id.0], None).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider `Option::take()` instead: `self.colors[c_id.0].take()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_option_with_none
= note: `#[warn(clippy::mem_replace_option_with_none)]` on by default
|
unneeded `return` statement:
src/egraph.rs#L1838
warning: unneeded `return` statement
--> src/egraph.rs:1838:9
|
1838 | return c_id;
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
|
1838 - return c_id;
1838 + c_id
|
|
returning the result of a `let` binding from a block:
src/egraph.rs#L1814
warning: returning the result of a `let` binding from a block
--> src/egraph.rs:1814:9
|
1813 | let new_color_id = self.create_color(Some(color));
| -------------------------------------------------- unnecessary `let` binding
1814 | new_color_id
| ^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
= note: `#[warn(clippy::let_and_return)]` on by default
help: return the expression directly
|
1813 ~
1814 ~ self.create_color(Some(color))
|
|
called `is_some()` after searching an `Iterator` with `find`:
src/egraph.rs#L1710
warning: called `is_some()` after searching an `Iterator` with `find`
--> src/egraph.rs:1710:45
|
1710 | ... if fixed.iter().find(|x| *x == key).is_some() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| x == key)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some
|
called `is_some()` after searching an `Iterator` with `find`:
src/egraph.rs#L1696
warning: called `is_some()` after searching an `Iterator` with `find`
--> src/egraph.rs:1696:60
|
1696 | ... if self[id_i].nodes.iter().find(|x| *x == key).is_some() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x| x == key)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some
= note: `#[warn(clippy::search_is_some)]` on by default
|
casting to the same type is unnecessary (`usize` -> `usize`):
src/egraph.rs#L1695
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> src/egraph.rs:1695:49
|
1695 | for id_i in self.colors[c.0 as usize].as_ref().unwrap().equality_class(self, *id) {
| ^^^^^^^^^^^^ help: try: `c.0`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
= note: `#[warn(clippy::unnecessary_cast)]` on by default
|
length comparison to zero:
src/egraph.rs#L1645
warning: length comparison to zero
--> src/egraph.rs:1645:24
|
1645 | if n.children().len() > 0
| ^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!n.children().is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
|
using `clone` on type `Option<bool>` which implements the `Copy` trait:
src/egraph.rs#L1618
warning: using `clone` on type `Option<bool>` which implements the `Copy` trait
--> src/egraph.rs:1618:55
|
1618 | ... if let Some(is_deleted) = is_deleted.clone() {
| ^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*is_deleted`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
|
use of `unwrap_or` to construct default value:
src/egraph.rs#L1464
warning: use of `unwrap_or` to construct default value
--> src/egraph.rs:1464:78
|
1464 | for (mut p, id) in self[g].colored_parents.remove(&c_id).unwrap_or(vec![]) {
| ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
= note: `#[warn(clippy::unwrap_or_default)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/egraph.rs#L1449
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/egraph.rs:1449:75
|
1449 | let allids = self.get_color(c_id).unwrap().equality_class(&self, id).collect_vec();
| ^^^^^ help: change this to: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`:
src/egraph.rs#L1393
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> src/egraph.rs:1393:59
|
1393 | let color_parents = self.get_colors_parents(c_id).into_iter().copied().collect_vec();
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
= note: `#[warn(clippy::into_iter_on_ref)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/egraph.rs#L1048
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/egraph.rs:1048:66
|
1048 | for id in self.get_color(*c).unwrap().equality_class(&self, *id) {
| ^^^^^ help: change this to: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/egraph.rs#L1023
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/egraph.rs:1023:21
|
1023 | add(&first);
| ^^^^^^ help: change this to: `first`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
length comparison to zero:
src/egraph.rs#L1020
warning: length comparison to zero
--> src/egraph.rs:1020:16
|
1020 | if classes[key.0 as usize].as_mut().unwrap().nodes.len() > 0 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!classes[key.0 as usize].as_mut().unwrap().nodes.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
= note: `#[warn(clippy::len_zero)]` on by default
|
using `clone` on type `Option<ColorId>` which implements the `Copy` trait:
src/egraph.rs#L989
warning: using `clone` on type `Option<ColorId>` which implements the `Copy` trait
--> src/egraph.rs:989:30
|
989 | if let Some(c) = classes[key.0 as usize].as_mut().unwrap().color.clone() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `classes[key.0 as usize].as_mut().unwrap().color`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
|
you seem to be trying to pop elements from a `Vec` in a loop:
src/egraph.rs#L923
warning: you seem to be trying to pop elements from a `Vec` in a loop
--> src/egraph.rs:923:13
|
923 | let (color, node, id) = todo.pop().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_while_let_some
= note: `#[warn(clippy::manual_while_let_some)]` on by default
help: consider using a `while..let` loop
|
922 ~ while let Some((color, node, id)) = todo.pop() {
923 ~
|
|
using `clone` on type `Option<ColorId>` which implements the `Copy` trait:
src/egraph.rs#L916
warning: using `clone` on type `Option<ColorId>` which implements the `Copy` trait
--> src/egraph.rs:916:47
|
916 | blocked.insert(*cid, (color.clone(), node.clone(), *id));
| ^^^^^^^^^^^^^ help: try removing the `clone` call: `color`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
= note: `#[warn(clippy::clone_on_copy)]` on by default
|
redundant pattern matching, consider using `is_none()`:
src/egraph.rs#L915
warning: redundant pattern matching, consider using `is_none()`
--> src/egraph.rs:915:28
|
915 | if let None = translator.get(id) {
| -------^^^^--------------------- help: try: `if translator.get(id).is_none()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
= note: `#[warn(clippy::redundant_pattern_matching)]` on by default
|
the following explicit lifetimes could be elided: 'a:
src/egraph.rs#L883
warning: the following explicit lifetimes could be elided: 'a
--> src/egraph.rs:883:17
|
883 | pub fn dump<'a>(&'a self) -> impl Debug + 'a {
| ^^ ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
= note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
|
883 - pub fn dump<'a>(&'a self) -> impl Debug + 'a {
883 + pub fn dump(&self) -> impl Debug + '_ {
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/egraph.rs#L787
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/egraph.rs:787:43
|
787 | let best = Extractor::new(&self, AstSize).find_best(id).1;
| ^^^^^ help: change this to: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/egraph.rs#L785
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/egraph.rs:785:46
|
785 | let matches = goal.search_eclass(&self, id);
| ^^^^^ help: change this to: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/egraph.rs#L726
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/egraph.rs:726:33
|
726 | data: N::make(self, &enode),
| ^^^^^^ help: change this to: `enode`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
`filter(..).map(..)` can be simplified as `filter_map(..)`:
src/egraph.rs#L261
warning: `filter(..).map(..)` can be simplified as `filter_map(..)`
--> src/egraph.rs:261:14
|
261 | .filter(|c| c.is_some())
| ______________^
262 | | .map(|c| c.as_ref().unwrap())
| |_________________________________________^ help: try: `filter_map(|c| c.as_ref())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_filter_map
= note: `#[warn(clippy::manual_filter_map)]` on by default
|
`to_string` applied to a type that implements `Display` in `writeln!` args:
src/dot.rs#L351
warning: `to_string` applied to a type that implements `Display` in `writeln!` args
--> src/dot.rs:351:21
|
351 | class.id.to_string()
| ^^^^^^^^^^^^ help: remove this
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
= note: `#[warn(clippy::to_string_in_format_args)]` on by default
|
writing `&Vec` instead of `&[_]` involves a new object where a slice will do:
src/dot.rs#L340
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> src/dot.rs:340:24
|
340 | dropped_nodes: &Vec<L>,
| ^^^^^^^ help: change this to: `&[L]`
|
= 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
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/dot.rs#L191
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/dot.rs:191:31
|
191 | .filter(|c| !pred(&self.egraph, c.id))
| ^^^^^^^^^^^^ help: change this to: `self.egraph`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `#[warn(clippy::needless_borrow)]` on by default
|
very complex type used. Consider factoring parts into `type` definitions:
src/dot.rs#L182
warning: very complex type used. Consider factoring parts into `type` definitions
--> src/dot.rs:182:19
|
182 | let pred: Rc<dyn Fn(&EGraph<L, N>, Id) -> bool> = if let Some(b) = self.pred.clone() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
|
the borrowed expression implements the required traits:
src/dot.rs#L102
warning: the borrowed expression implements the required traits
--> src/dot.rs:102:22
|
102 | self.run_dot(&["-Tpdf".as_ref(), "-o".as_ref(), filename.as_ref()])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `["-Tpdf".as_ref(), "-o".as_ref(), filename.as_ref()]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
|
the borrowed expression implements the required traits:
src/dot.rs#L96
warning: the borrowed expression implements the required traits
--> src/dot.rs:96:22
|
96 | self.run_dot(&["-Tsvg".as_ref(), "-o".as_ref(), filename.as_ref()])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `["-Tsvg".as_ref(), "-o".as_ref(), filename.as_ref()]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
|
the borrowed expression implements the required traits:
src/dot.rs#L90
warning: the borrowed expression implements the required traits
--> src/dot.rs:90:22
|
90 | self.run_dot(&["-Tpng".as_ref(), "-o".as_ref(), filename.as_ref()])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `["-Tpng".as_ref(), "-o".as_ref(), filename.as_ref()]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
|
very complex type used. Consider factoring parts into `type` definitions:
src/dot.rs#L63
warning: very complex type used. Consider factoring parts into `type` definitions
--> src/dot.rs:63:22
|
63 | pub(crate) pred: Option<Rc<dyn Fn(&EGraph<L, N>, Id) -> bool + 'static>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
= note: `#[warn(clippy::type_complexity)]` on by default
|
casting the result of `i32::abs()` to u32:
src/macros.rs#L94
warning: casting the result of `i32::abs()` to u32
--> src/macros.rs:94:9
|
94 | self.abs() as u32
| ^^^^^^^^^^^^^^^^^ help: replace with: `self.unsigned_abs()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_abs_to_unsigned
= note: `#[warn(clippy::cast_abs_to_unsigned)]` on by default
|
methods `extend`, `pop`, and `is_empty` are never used:
src/util.rs#L251
warning: methods `extend`, `pop`, and `is_empty` are never used
--> src/util.rs:251:12
|
241 | / impl<T> UniqueQueue<T>
242 | | where
243 | | T: Eq + std::hash::Hash + Clone,
| |____________________________________- methods in this implementation
...
251 | pub fn extend<I>(&mut self, iter: I)
| ^^^^^^
...
260 | pub fn pop(&mut self) -> Option<T> {
| ^^^
...
266 | pub fn is_empty(&self) -> bool {
| ^^^^^^^^
|
method `disp_string` is never used:
src/util.rs#L188
warning: method `disp_string` is never used
--> src/util.rs:188:8
|
187 | pub(crate) trait JoinDisp {
| -------- method in this trait
188 | fn disp_string(self) -> String;
| ^^^^^^^^^^^
|
method `debug_print_all` is never used:
src/unionfind.rs#L213
warning: method `debug_print_all` is never used
--> src/unionfind.rs:213:19
|
212 | impl<T:Default + Merge, K: Clone + Ord + Debug> UnionFindWrapper<T, K> {
| ---------------------------------------------------------------------- method in this implementation
213 | pub(crate) fn debug_print_all(&self) {
| ^^^^^^^^^^^^^^^
|
methods `get` and `get_mut` are never used:
src/unionfind.rs#L122
warning: methods `get` and `get_mut` are never used
--> src/unionfind.rs:122:8
|
121 | impl<T: Merge, K: Clone + Ord> UnionFindWrapper<T, K> {
| ----------------------------------------------------- methods in this implementation
122 | fn get(&self, key: &K) -> Option<&T> {
| ^^^
...
129 | pub fn get_mut(&mut self, key: &K) -> Option<&T> {
| ^^^^^^^
|
method `size` is never used:
src/unionfind.rs#L11
warning: method `size` is never used
--> src/unionfind.rs:11:8
|
6 | pub trait UnionFind {
| --------- method in this trait
...
11 | fn size(&self) -> usize;
| ^^^^
|
= note: `#[warn(dead_code)]` on by default
|
unused variable: `iteration`:
src/run.rs#L899
warning: unused variable: `iteration`
--> src/run.rs:899:9
|
899 | iteration: usize,
| ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_iteration`
|
unused variable: `n_rebuilds`:
src/run.rs#L507
warning: unused variable: `n_rebuilds`
--> src/run.rs:507:13
|
507 | let n_rebuilds = self.egraph.rebuild();
| ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_n_rebuilds`
|
unused variable: `other`:
src/egraph.rs#L900
warning: unused variable: `other`
--> src/egraph.rs:900:36
|
900 | pub fn egraph_union(&mut self, other: &EGraph<L, N>) {
| ^^^^^ help: if this is intentional, prefix it with an underscore: `_other`
|
= note: `#[warn(unused_variables)]` on by default
|
unreachable statement:
src/egraph.rs#L902
warning: unreachable statement
--> src/egraph.rs:902:9
|
901 | unimplemented!();
| ---------------- any code following this expression is unreachable
902 | let mut translator = IndexMap::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement
|
= note: `#[warn(unreachable_code)]` on by default
|
unused import: `SimpleUnionFind`:
src/colors.rs#L10
warning: unused import: `SimpleUnionFind`
--> src/colors.rs:10:24
|
10 | use crate::unionfind::{SimpleUnionFind, UnionFindWrapper};
| ^^^^^^^^^^^^^^^
|
unused import: `crate::colored_union_find::ColoredUnionFind`:
src/colors.rs#L9
warning: unused import: `crate::colored_union_find::ColoredUnionFind`
--> src/colors.rs:9:5
|
9 | use crate::colored_union_find::ColoredUnionFind;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
redundant field names in struct initialization:
src/ser.rs#L165
warning: redundant field names in struct initialization
--> src/ser.rs:165:17
|
165 | id: id,
| ^^^^^^ help: replace it with: `id`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
= note: `#[warn(clippy::redundant_field_names)]` on by default
|
unneeded unit return type:
src/machine.rs#L74
warning: unneeded unit return type
--> src/machine.rs:74:26
|
74 | mut f: impl FnMut(&L) -> (),
| ^^^^^^ help: remove the `-> ()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit
= note: `#[warn(clippy::unused_unit)]` on by default
|
unused import: `Cell`:
src/machine.rs#L1
warning: unused import: `Cell`
--> src/machine.rs:1:17
|
1 | use std::cell::{Cell, RefCell};
| ^^^^
|
= note: `#[warn(unused_imports)]` on by default
|
unexpected `cfg` condition value: `serde-1`:
src/language.rs#L309
warning: unexpected `cfg` condition value: `serde-1`
--> src/language.rs:309:7
|
309 | #[cfg(feature = "serde-1")]
| ^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `colored`, `colored_no_cmemo`, `colored_no_cremove`, `concurrent_cufind`, `crossbeam`, `default`, `keep_splits`, `parallel`, `rayon`, `reports`, `upward-merging`, and `wasm-bindgen`
= help: consider adding `serde-1` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
|
unexpected `cfg` condition value: `stats`:
src/egraph.rs#L1044
warning: unexpected `cfg` condition value: `stats`
--> src/egraph.rs:1044:15
|
1044 | #[cfg(feature = "stats")] {
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `colored`, `colored_no_cmemo`, `colored_no_cremove`, `concurrent_cufind`, `crossbeam`, `default`, `keep_splits`, `parallel`, `rayon`, `reports`, `upward-merging`, and `wasm-bindgen`
= help: consider adding `stats` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
|
build
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions-rs/toolchain@v1, actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
build
The following actions use a deprecated Node.js version and will be forced to run on node20: actions/checkout@v2, actions-rs/toolchain@v1, actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|
build
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
build
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
build
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
build
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|