Skip to content

Bump to 0.2.1

Bump to 0.2.1 #33

GitHub Actions / clippy succeeded Jan 5, 2024 in 0s

clippy

48 warnings

Details

Results

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

Versions

  • rustc 1.74.1 (a28077b28 2023-12-04)
  • cargo 1.74.1 (ecb9851af 2023-10-18)
  • clippy 0.1.74 (a28077b 2023-12-04)

Annotations

Check warning on line 86 in scanflow-cli/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions
  --> scanflow-cli/src/main.rs:81:6
   |
81 |   ) -> Result<(
   |  ______^
82 | |     Either<OsChain, ConnectorChain>,
83 | |     Option<&str>,
84 | |     bool,
85 | |     log::Level,
86 | | )> {
   | |__^
   |
   = 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

Check warning on line 38 in scanflow-cli/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
  --> scanflow-cli/src/main.rs:38:51
   |
38 |             let process = os.into_process_by_name(&target)?;
   |                                                   ^^^^^^^ help: change this to: `target`
   |
   = 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

Check warning on line 728 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead

warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
   --> scanflow-cli/src/cli.rs:725:13
    |
725 |       let b = TYPES
    |  _____________^
726 | |         .iter()
727 | |         .filter(|Type(name, _, _, _)| name == &typename)
728 | |         .next()?
    | |_______________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#filter_next
help: try
    |
725 ~     let b = TYPES
726 ~         .iter().find(|Type(name, _, _, _)| name == &typename)?
    |

Check warning on line 721 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

single-character string constant used as pattern

warning: single-character string constant used as pattern
   --> scanflow-cli/src/cli.rs:721:41
    |
721 |         let mut words = input.splitn(2, " ");
    |                                         ^^^ help: try using a `char` instead: `' '`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern

Check warning on line 86 in scanflow-cli/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions
  --> scanflow-cli/src/main.rs:81:6
   |
81 |   ) -> Result<(
   |  ______^
82 | |     Either<OsChain, ConnectorChain>,
83 | |     Option<&str>,
84 | |     bool,
85 | |     log::Level,
86 | | )> {
   | |__^
   |
   = 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

Check warning on line 713 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead

warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
   --> scanflow-cli/src/cli.rs:710:5
    |
710 | /     TYPES
711 | |         .iter()
712 | |         .filter(|Type(name, _, _, _)| name == &typename)
713 | |         .next()
    | |_______________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#filter_next
help: try
    |
710 ~     TYPES
711 +         .iter().find(|Type(name, _, _, _)| name == &typename)
    |

Check warning on line 38 in scanflow-cli/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
  --> scanflow-cli/src/main.rs:38:51
   |
38 |             let process = os.into_process_by_name(&target)?;
   |                                                   ^^^^^^^ help: change this to: `target`
   |
   = 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

Check warning on line 728 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead

warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
   --> scanflow-cli/src/cli.rs:725:13
    |
725 |       let b = TYPES
    |  _____________^
726 | |         .iter()
727 | |         .filter(|Type(name, _, _, _)| name == &typename)
728 | |         .next()?
    | |_______________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#filter_next
help: try
    |
725 ~     let b = TYPES
726 ~         .iter().find(|Type(name, _, _, _)| name == &typename)?
    |

Check warning on line 721 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

single-character string constant used as pattern

warning: single-character string constant used as pattern
   --> scanflow-cli/src/cli.rs:721:41
    |
721 |         let mut words = input.splitn(2, " ");
    |                                         ^^^ help: try using a `char` instead: `' '`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern

Check warning on line 713 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead

warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
   --> scanflow-cli/src/cli.rs:710:5
    |
710 | /     TYPES
711 | |         .iter()
712 | |         .filter(|Type(name, _, _, _)| name == &typename)
713 | |         .next()
    | |_______________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#filter_next
help: try
    |
710 ~     TYPES
711 +         .iter().find(|Type(name, _, _, _)| name == &typename)
    |

Check warning on line 625 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless use of `format!`

warning: useless use of `format!`
   --> scanflow-cli/src/cli.rs:625:18
    |
625 |             Some(format!("{}", String::from_utf16_lossy(&vec)))
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `String::from_utf16_lossy(&vec).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

Check warning on line 590 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

`to_string` applied to a type that implements `Display` in `println!` args

warning: `to_string` applied to a type that implements `Display` in `println!` args
   --> scanflow-cli/src/cli.rs:590:57
    |
590 |                     println!("Error reading line: {}", e.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

Check warning on line 555 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

single-character string constant used as pattern

warning: single-character string constant used as pattern
   --> scanflow-cli/src/cli.rs:555:36
    |
555 |     let mut words = args.splitn(3, " ");
    |                                    ^^^ help: try using a `char` instead: `' '`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
    = note: `#[warn(clippy::single_char_pattern)]` on by default

Check warning on line 625 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless use of `format!`

warning: useless use of `format!`
   --> scanflow-cli/src/cli.rs:625:18
    |
625 |             Some(format!("{}", String::from_utf16_lossy(&vec)))
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `String::from_utf16_lossy(&vec).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

Check warning on line 590 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

`to_string` applied to a type that implements `Display` in `println!` args

warning: `to_string` applied to a type that implements `Display` in `println!` args
   --> scanflow-cli/src/cli.rs:590:57
    |
590 |                     println!("Error reading line: {}", e.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

Check warning on line 555 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

single-character string constant used as pattern

warning: single-character string constant used as pattern
   --> scanflow-cli/src/cli.rs:555:36
    |
555 |     let mut words = args.splitn(3, " ");
    |                                    ^^^ help: try using a `char` instead: `' '`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
    = note: `#[warn(clippy::single_char_pattern)]` on by default

Check warning on line 397 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

explicit call to `.into_iter()` in function argument accepting `IntoIterator`

warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
   --> scanflow-cli/src/cli.rs:397:16
    |
397 |         .chain(proc_cmds().into_iter())
    |                ^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `proc_cmds()`
    |
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
   --> /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/iter/traits/iterator.rs:523:12
    = 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

Check warning on line 397 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

explicit call to `.into_iter()` in function argument accepting `IntoIterator`

warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
   --> scanflow-cli/src/cli.rs:397:16
    |
397 |         .chain(proc_cmds().into_iter())
    |                ^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `proc_cmds()`
    |
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
   --> /rustc/a28077b28a02b92985b3a3faecf92813155f1ea1/library/core/src/iter/traits/iterator.rs:523:12
    = 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

Check warning on line 171 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead

warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
   --> scanflow-cli/src/cli.rs:168:52
    |
168 |                   if let Some(Type(_, size, _, _)) = TYPES
    |  ____________________________________________________^
169 | |                     .iter()
170 | |                     .filter(|Type(name, _, _, _)| name == &arg)
171 | |                     .next()
    | |___________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#filter_next
    = note: `#[warn(clippy::filter_next)]` on by default
help: try
    |
168 ~                 if let Some(Type(_, size, _, _)) = TYPES
169 +                     .iter().find(|Type(name, _, _, _)| name == &arg)
    |

Check warning on line 171 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead

warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
   --> scanflow-cli/src/cli.rs:168:52
    |
168 |                   if let Some(Type(_, size, _, _)) = TYPES
    |  ____________________________________________________^
169 | |                     .iter()
170 | |                     .filter(|Type(name, _, _, _)| name == &arg)
171 | |                     .next()
    | |___________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#filter_next
    = note: `#[warn(clippy::filter_next)]` on by default
help: try
    |
168 ~                 if let Some(Type(_, size, _, _)) = TYPES
169 +                     .iter().find(|Type(name, _, _, _)| name == &arg)
    |

Check warning on line 504 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `else { if .. }` block can be collapsed

warning: this `else { if .. }` block can be collapsed
   --> scanflow-cli/src/cli.rs:494:24
    |
494 |                   } else {
    |  ________________________^
495 | |                     if let Some((buf, t)) = parse_input(line, &ctx.typename) {
496 | |                         ctx.buf_len = buf.len();
497 | |                         ctx.value_scanner
...   |
503 | |                     }
504 | |                 }
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
    |
494 ~                 } else if let Some((buf, t)) = parse_input(line, &ctx.typename) {
495 +                     ctx.buf_len = buf.len();
496 +                     ctx.value_scanner
497 +                         .scan_for_2(&mut ctx.memory, ctx.funcs.maps, &buf)?;
498 +                     print_matches(&ctx.value_scanner, &mut ctx.memory, ctx.buf_len, &t)?;
499 +                     ctx.typename = Some(t);
500 +                 } else {
501 +                     println!("Invalid input! Use `help` for command reference.");
502 +                 }
    |

Check warning on line 504 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `else { if .. }` block can be collapsed

warning: this `else { if .. }` block can be collapsed
   --> scanflow-cli/src/cli.rs:494:24
    |
494 |                   } else {
    |  ________________________^
495 | |                     if let Some((buf, t)) = parse_input(line, &ctx.typename) {
496 | |                         ctx.buf_len = buf.len();
497 | |                         ctx.value_scanner
...   |
503 | |                     }
504 | |                 }
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
    |
494 ~                 } else if let Some((buf, t)) = parse_input(line, &ctx.typename) {
495 +                     ctx.buf_len = buf.len();
496 +                     ctx.value_scanner
497 +                         .scan_for_2(&mut ctx.memory, ctx.funcs.maps, &buf)?;
498 +                     print_matches(&ctx.value_scanner, &mut ctx.memory, ctx.buf_len, &t)?;
499 +                     ctx.typename = Some(t);
500 +                 } else {
501 +                     println!("Invalid input! Use `help` for command reference.");
502 +                 }
    |

Check warning on line 486 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `else { if .. }` block can be collapsed

warning: this `else { if .. }` block can be collapsed
   --> scanflow-cli/src/cli.rs:467:24
    |
467 |                   } else {
    |  ________________________^
468 | |                     if let Some(cmd) = cmds
469 | |                         .iter_mut()
470 | |                         .find(|cmd| cmd.short == args || cmd.long == args)
...   |
485 | |                     }
486 | |                 }
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
    = note: `#[warn(clippy::collapsible_else_if)]` on by default
help: collapse nested if block
    |
467 ~                 } else if let Some(cmd) = cmds
468 +                     .iter_mut()
469 +                     .find(|cmd| cmd.short == args || cmd.long == args)
470 +                 {
471 +                     println!("{}", cmd.help);
472 +                     println!();
473 +                     if let Some(long) = cmd.long_help {
474 +                         println!("{}", long);
475 +                     } else {
476 +                         println!("(no further help available)");
477 +                     }
478 +                 } else if ["quit", "help", "q", "h"].contains(&args) {
479 +                     println!("Built-in command with no further help");
480 +                 } else {
481 +                     println!(
482 +                         "Could not find command `{args}`. Use `help` for command reference."
483 +                     );
484 +                 }
    |

Check warning on line 486 in scanflow-cli/src/cli.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `else { if .. }` block can be collapsed

warning: this `else { if .. }` block can be collapsed
   --> scanflow-cli/src/cli.rs:467:24
    |
467 |                   } else {
    |  ________________________^
468 | |                     if let Some(cmd) = cmds
469 | |                         .iter_mut()
470 | |                         .find(|cmd| cmd.short == args || cmd.long == args)
...   |
485 | |                     }
486 | |                 }
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
    = note: `#[warn(clippy::collapsible_else_if)]` on by default
help: collapse nested if block
    |
467 ~                 } else if let Some(cmd) = cmds
468 +                     .iter_mut()
469 +                     .find(|cmd| cmd.short == args || cmd.long == args)
470 +                 {
471 +                     println!("{}", cmd.help);
472 +                     println!();
473 +                     if let Some(long) = cmd.long_help {
474 +                         println!("{}", long);
475 +                     } else {
476 +                         println!("(no further help available)");
477 +                     }
478 +                 } else if ["quit", "help", "q", "h"].contains(&args) {
479 +                     println!("Built-in command with no further help");
480 +                 } else {
481 +                     println!(
482 +                         "Could not find command `{args}`. Use `help` for command reference."
483 +                     );
484 +                 }
    |

Check warning on line 112 in scanflow/src/value_scanner.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`

warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take`
   --> scanflow/src/value_scanner.rs:112:31
    |
112 |             let old_matches = std::mem::replace(&mut self.matches, vec![]);
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(&mut self.matches)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default
    = note: `#[warn(clippy::mem_replace_with_default)]` on by default