Skip to content

Apply clippy suggestions #4

Apply clippy suggestions

Apply clippy suggestions #4

GitHub Actions / clippy succeeded Oct 3, 2024 in 0s

clippy

15 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 15
Note 0
Help 0

Versions

  • rustc 1.81.0 (eeb90cda1 2024-09-04)
  • cargo 1.81.0 (2dbb1af80 2024-08-20)
  • clippy 0.1.81 (eeb90cd 2024-09-04)

Annotations

Check warning on line 225 in src/check/constrain/generate/definition.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

call to `.deref()` on a reference in this situation does nothing

warning: call to `.deref()` on a reference in this situation does nothing
   --> src/check/constrain/generate/definition.rs:225:46
    |
225 |     let identifier = Identifier::try_from(var.deref())?.as_mutable(mutable);
    |                                              ^^^^^^^^
    |
    = note: the type `parse::ast::AST` does not implement `Deref`, so calling `deref` on `&parse::ast::AST` copies the reference, which does not do anything and can be removed
    = note: `#[warn(noop_method_call)]` on by default
help: remove this redundant call
    |
225 -     let identifier = Identifier::try_from(var.deref())?.as_mutable(mutable);
225 +     let identifier = Identifier::try_from(var)?.as_mutable(mutable);
    |
help: if you meant to clone `parse::ast::AST`, implement `Clone` for it
   --> src/parse/ast/mod.rs:14:1
    |
14  + #[derive(Clone)]
15  | pub struct AST {
    |

Check warning on line 240 in src/check/constrain/generate/call.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless use of `vec!`

warning: useless use of `vec!`
   --> src/check/constrain/generate/call.rs:240:24
    |
240 |             let args = vec![last_inst.clone()]
    |                        ^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[last_inst.clone()]`
    |
    = 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

Check warning on line 34 in src/io.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

file opened with `create`, but `truncate` behavior not defined

warning: file opened with `create`, but `truncate` behavior not defined
  --> src/io.rs:34:10
   |
34 |         .create(true)
   |          ^^^^^^^^^^^^- help: add: `.truncate(true)`
   |
   = help: if you intend to overwrite an existing file entirely, call `.truncate(true)`
   = help: if you instead know that you may want to keep some parts of the old file, call `.truncate(false)`
   = help: alternatively, use `.append(true)` to append to the file instead of overwriting it
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_open_options
   = note: `#[warn(clippy::suspicious_open_options)]` on by default

Check warning on line 29 in src/parse/operation.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

doc list item without indentation

warning: doc list item without indentation
  --> src/parse/operation.rs:29:5
   |
29 | /// in not, is a, is not a
   |     ^
   |
   = help: if this is supposed to be its own paragraph, add a blank line
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
help: indent this line
   |
29 | ///    in not, is a, is not a
   |     +++

Check warning on line 56 in src/generate/name.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

accessing first element with `self.generics.get(0)`

warning: accessing first element with `self.generics.get(0)`
  --> src/generate/name.rs:56:28
   |
56 |                 let args = self.generics.get(0).cloned().unwrap_or_else(Name::empty);
   |                            ^^^^^^^^^^^^^^^^^^^^ help: try: `self.generics.first()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first

Check warning on line 186 in src/generate/convert/class.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `std::collections::hash_map::Values<'_, generate::ast::node::Core, (usize, generate::ast::node::Core)>`

warning: useless conversion to the same type: `std::collections::hash_map::Values<'_, generate::ast::node::Core, (usize, generate::ast::node::Core)>`
   --> src/generate/convert/class.rs:184:33
    |
184 |       let body_stmts: Vec<Core> = body_name_stmts
    |  _________________________________^
185 | |         .values()
186 | |         .into_iter()
    | |____________________^
    |
    = 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
help: consider removing `.into_iter()`
    |
184 ~     let body_stmts: Vec<Core> = body_name_stmts
185 +         .values()
    |

Check warning on line 500 in src/check/name/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

usage of `Iterator::fold` on a type that implements `Try`

warning: usage of `Iterator::fold` on a type that implements `Try`
   --> src/check/name/mod.rs:492:27
    |
492 |           self.names.iter().fold(Ok(mapping), |acc, s_n| {
    |  ___________________________^
493 | |             other.names.iter().fold(acc, |acc, o_n| {
494 | |                 if let Ok(acc) = acc {
495 | |                     s_n.temp_map(&o_n.variant, acc, pos)
...   |
499 | |             })
500 | |         })
    | |__________^ help: use `try_fold` instead: `try_fold(mapping, |acc, s_n| ...)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_try_fold
    = note: `#[warn(clippy::manual_try_fold)]` on by default

Check warning on line 173 in src/check/name/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

non-canonical implementation of `partial_cmp` on an `Ord` type

warning: non-canonical implementation of `partial_cmp` on an `Ord` type
   --> src/check/name/mod.rs:167:1
    |
167 | /  impl PartialOrd<Self> for Name {
168 | |      fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
    | | _____________________________________________________________-
169 | ||         let self_vec = self.names.iter().sorted();
170 | ||         let other_vec = other.names.iter().sorted();
171 | ||         self_vec.partial_cmp(other_vec)
172 | ||     }
    | ||_____- help: change this to: `{ Some(self.cmp(other)) }`
173 | |  }
    | |__^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#non_canonical_partial_ord_impl

Check warning on line 116 in src/check/name/true_name/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

doc list item without indentation

warning: doc list item without indentation
   --> src/check/name/true_name/mod.rs:116:9
    |
116 |     /// If self is not nullable, then super of other iff:
    |         ^
    |
    = help: if this is supposed to be its own paragraph, add a blank line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
    = note: `#[warn(clippy::doc_lazy_continuation)]` on by default
help: indent this line
    |
116 |     ///   If self is not nullable, then super of other iff:
    |         ++

Check warning on line 52 in src/check/name/true_name/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

non-canonical implementation of `partial_cmp` on an `Ord` type

warning: non-canonical implementation of `partial_cmp` on an `Ord` type
  --> src/check/name/true_name/mod.rs:40:1
   |
40 | /  impl PartialOrd<Self> for TrueName {
41 | |      fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
   | | _____________________________________________________________-
42 | ||         if self.variant == other.variant {
43 | ||             if self.is_nullable == other.is_nullable {
44 | ||                 self.is_mutable.partial_cmp(&other.is_mutable)
...  ||
50 | ||         }
51 | ||     }
   | ||_____- help: change this to: `{ Some(self.cmp(other)) }`
52 | |  }
   | |__^
   |
   = 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

Check warning on line 197 in src/check/name/string_name/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

accessing first element with `self.generics.get(0)`

warning: accessing first element with `self.generics.get(0)`
   --> src/check/name/string_name/mod.rs:197:28
    |
197 |                 let args = self.generics.get(0).expect("Unreachable");
    |                            ^^^^^^^^^^^^^^^^^^^^ help: try: `self.generics.first()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
    = note: `#[warn(clippy::get_first)]` on by default

Check warning on line 38 in src/check/constrain/unify/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `map_err` over `inspect_err`

warning: using `map_err` over `inspect_err`
  --> src/check/constrain/unify/mod.rs:38:14
   |
38 |             .map_err(|e| {
   |              ^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_inspect
   = note: `#[warn(clippy::manual_inspect)]` on by default
help: try
   |
38 ~             .inspect_err(|e| {
39 |                 trace!(
...
46 |                     }))
47 ~                 );
   |

Check warning on line 89 in src/check/constrain/generate/statement.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

if let can be simplified with `.unwrap_or_default()`

warning: if let can be simplified with `.unwrap_or_default()`
  --> src/check/constrain/generate/statement.rs:85:25
   |
85 | /                         if let Ok(result) = raise_class.has_parent(env_raise, ctx, pos) {
86 | |                             result
87 | |                         } else {
88 | |                             false
89 | |                         }
   | |_________________________^ help: replace it with: `raise_class.has_parent(env_raise, ctx, pos).unwrap_or_default()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default
   = note: `#[warn(clippy::manual_unwrap_or_default)]` on by default

Check warning on line 89 in src/check/constrain/generate/statement.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this pattern reimplements `Result::unwrap_or`

warning: this pattern reimplements `Result::unwrap_or`
  --> src/check/constrain/generate/statement.rs:85:25
   |
85 | /                         if let Ok(result) = raise_class.has_parent(env_raise, ctx, pos) {
86 | |                             result
87 | |                         } else {
88 | |                             false
89 | |                         }
   | |_________________________^ help: replace with: `raise_class.has_parent(env_raise, ctx, pos).unwrap_or(false)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or
   = note: `#[warn(clippy::manual_unwrap_or)]` on by default

Check warning on line 13 in src/generate/convert/state.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

field `tup` is never read

warning: field `tup` is never read
  --> src/generate/convert/state.rs:13:9
   |
10 | pub struct State {
   |            ----- field in this struct
...
13 |     pub tup: usize,
   |         ^^^
   |
   = note: `State` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis
   = note: `#[warn(dead_code)]` on by default