Skip to content

Work on warnings

Work on warnings #200

GitHub Actions / clippy succeeded Sep 10, 2024 in 1s

clippy

35 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 35
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 888 in src/chsr/cli/process/json.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

field assignment outside of initializer for an instance created with Default::default()

warning: field assignment outside of initializer for an instance created with Default::default()
   --> src/chsr/cli/process/json.rs:888:13
    |
888 |             path.default_behavior = options_path_policy;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `rar_common::database::options::SPathOptions { default_behavior: options_path_policy, ..Default::default() }` and removing relevant reassignments
   --> src/chsr/cli/process/json.rs:887:13
    |
887 |             let mut path = SPathOptions::default();
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default

Check warning on line 610 in src/chsr/cli/process/json.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

field assignment outside of initializer for an instance created with Default::default()

warning: field assignment outside of initializer for an instance created with Default::default()
   --> src/chsr/cli/process/json.rs:610:9
    |
610 |         env.default_behavior = options_env_policy;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `rar_common::database::options::SEnvOptions { default_behavior: options_env_policy, ..Default::default() }` and removing relevant reassignments
   --> src/chsr/cli/process/json.rs:609:9
    |
609 |         let mut env = SEnvOptions::default();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
    = note: `#[warn(clippy::field_reassign_with_default)]` on by default

Check warning on line 22 in src/chsr/cli/pair.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
  --> src/chsr/cli/pair.rs:22:18
   |
22 |     do_matching: &dyn Fn(&Pair<Rule>, &mut Inputs) -> Result<(), Box<dyn Error>>,
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = 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 51 in src/chsr/cli/data.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

all variants have the same postfix: `List`

warning: all variants have the same postfix: `List`
  --> src/chsr/cli/data.rs:46:1
   |
46 | / pub enum SetListType {
47 | |     WhiteList,
48 | |     BlackList,
49 | |     CheckList,
50 | |     SetList,
51 | | }
   | |_^
   |
   = 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

Check warning on line 409 in src/sr/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary `if let` since only the `Some` variant of the iterator element is used

warning: unnecessary `if let` since only the `Some` variant of the iterator element is used
   --> src/sr/main.rs:405:13
    |
405 |               for group in res {
    |               ^            --- help: try: `res.flatten()`
    |  _____________|
    | |
406 | |                 if let Some(group) = group {
407 | |                     groups.push(group.gid.as_raw());
408 | |                 }
409 | |             }
    | |_____________^
    |
help: ...and remove the `if let` statement in the for loop
   --> src/sr/main.rs:406:17
    |
406 | /                 if let Some(group) = group {
407 | |                     groups.push(group.gid.as_raw());
408 | |                 }
    | |_________________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten
    = note: `#[warn(clippy::manual_flatten)]` on by default

Check warning on line 329 in src/sr/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

returning the result of a `let` binding from a block

warning: returning the result of a `let` binding from a block
   --> src/sr/main.rs:329:5
    |
323 | /     let user = Cred {
324 | |         user,
325 | |         groups,
326 | |         tty,
327 | |         ppid,
328 | |     };
    | |______- unnecessary `let` binding
329 |       user
    |       ^^^^
    |
    = 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
    |
323 ~     
324 ~     Cred {
325 +         user,
326 +         groups,
327 +         tty,
328 +         ppid,
329 +     }
    |

Check warning on line 284 in src/sr/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

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

warning: `to_string` applied to a type that implements `Display` in `eprintln!` args
   --> src/sr/main.rs:284:68
    |
284 |             eprintln!("sr: {} : {}", execcfg.exec_path.display(), 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 221 in src/sr/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

current MSRV (Minimum Supported Rust Version) is `1.74.1` but this item is stable since `1.76.0`

warning: current MSRV (Minimum Supported Rust Version) is `1.74.1` but this item is stable since `1.76.0`
   --> src/sr/main.rs:219:14
    |
219 |               .inspect_err(|e| {
    |  ______________^
220 | |                 error!("{}", e);
221 | |             })
    | |______________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
    = note: `#[warn(clippy::incompatible_msrv)]` on by default

Check warning on line 182 in src/sr/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this loop could be written as a `for` loop

warning: this loop could be written as a `for` loop
   --> src/sr/main.rs:182:5
    |
182 |     while let Some(arg) = iter.next() {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for arg in iter`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator
    = note: `#[warn(clippy::while_let_on_iterator)]` on by default

Check warning on line 184 in src/sr/timeout.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits
   --> src/sr/timeout.rs:184:15
    |
184 |         .join(&user.user.uid.as_raw().to_string())
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `user.user.uid.as_raw().to_string()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args

Check warning on line 181 in src/sr/timeout.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits
   --> src/sr/timeout.rs:181:44
    |
181 |     let path = Path::new(TS_LOCATION).join(&user.user.uid.as_raw().to_string());
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `user.user.uid.as_raw().to_string()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args

Check warning on line 164 in src/sr/timeout.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits
   --> src/sr/timeout.rs:164:44
    |
164 |     let path = Path::new(TS_LOCATION).join(&user.user.uid.as_raw().to_string());
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `user.user.uid.as_raw().to_string()`
    |
    = 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

Check warning on line 40 in src/sr/timeout.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

name `PPID` contains a capitalized acronym

warning: name `PPID` contains a capitalized acronym
  --> src/sr/timeout.rs:40:5
   |
40 |     PPID(pid_t),
   |     ^^^^ help: consider making the acronym lowercase, except the initial letter: `Ppid`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms

Check warning on line 39 in src/sr/timeout.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

name `TTY` contains a capitalized acronym

warning: name `TTY` contains a capitalized acronym
  --> src/sr/timeout.rs:39:5
   |
39 |     TTY(dev_t),
   |     ^^^ help: consider making the acronym lowercase, except the initial letter: `Tty`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms
   = note: `#[warn(clippy::upper_case_acronyms)]` on by default

Check warning on line 86 in rar-common/src/util.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

passing a unit value to a function

warning: passing a unit value to a function
  --> rar-common/src/util.rs:79:5
   |
79 | /     Ok(match effective {
80 | |         false => {
81 | |             read_effective(false).and(dac_override_effective(false))?;
82 | |         }
...  |
85 | |         }
86 | |     })
   | |______^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
   = note: `#[warn(clippy::unit_arg)]` on by default
help: move the expression in front of the call and replace it with the unit literal `()`
   |
79 ~     match effective {
80 +         false => {
81 +             read_effective(false).and(dac_override_effective(false))?;
82 +         }
83 +         true => {
84 +             read_effective(true).or(dac_override_effective(true))?;
85 +         }
86 +     };
87 +     Ok(())
   |

Check warning on line 409 in rar-common/src/database/structs.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

field assignment outside of initializer for an instance created with Default::default()

warning: field assignment outside of initializer for an instance created with Default::default()
   --> rar-common/src/database/structs.rs:409:9
    |
409 |         ret.name = name;
    |         ^^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `database::structs::STask { name: name, _role: Some(role), ..Default::default() }` and removing relevant reassignments
   --> rar-common/src/database/structs.rs:408:9
    |
408 |         let mut ret = STask::default();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default

Check warning on line 392 in rar-common/src/database/structs.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

field assignment outside of initializer for an instance created with Default::default()

warning: field assignment outside of initializer for an instance created with Default::default()
   --> rar-common/src/database/structs.rs:392:9
    |
392 |         ret.name = name;
    |         ^^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `database::structs::SRole { name: name, _config: Some(config), ..Default::default() }` and removing relevant reassignments
   --> rar-common/src/database/structs.rs:391:9
    |
391 |         let mut ret = SRole::default();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default

Check warning on line 327 in rar-common/src/database/structs.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

field assignment outside of initializer for an instance created with Default::default()

warning: field assignment outside of initializer for an instance created with Default::default()
   --> rar-common/src/database/structs.rs:327:9
    |
327 |         c.add = capset;
    |         ^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `database::structs::SCapabilities { add: capset, ..Default::default() }` and removing relevant reassignments
   --> rar-common/src/database/structs.rs:326:9
    |
326 |         let mut c = SCapabilities::default();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default

Check warning on line 84 in rar-common/src/database/structs.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

enum `SGroups` has a public `len` method, but no `is_empty` method

warning: enum `SGroups` has a public `len` method, but no `is_empty` method
  --> rar-common/src/database/structs.rs:84:5
   |
84 |     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

Check warning on line 867 in rar-common/src/database/options.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
   --> rar-common/src/database/options.rs:861:10
    |
861 |       ) -> (
    |  __________^
862 | |         EnvBehavior,
863 | |         HashMap<String, String>,
864 | |         LinkedHashSet<EnvKey>,
865 | |         LinkedHashSet<EnvKey>,
866 | |         LinkedHashSet<EnvKey>,
867 | |     ) {
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

Check warning on line 731 in rar-common/src/database/options.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
   --> rar-common/src/database/options.rs:727:10
    |
727 |       ) -> (
    |  __________^
728 | |         PathBehavior,
729 | |         Rc<RefCell<LinkedHashSet<String>>>,
730 | |         Rc<RefCell<LinkedHashSet<String>>>,
731 | |     ) {
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

Check warning on line 676 in rar-common/src/database/options.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
   --> rar-common/src/database/options.rs:672:10
    |
672 |       ) -> (
    |  __________^
673 | |         PathBehavior,
674 | |         Rc<RefCell<LinkedHashSet<String>>>,
675 | |         Rc<RefCell<LinkedHashSet<String>>>,
676 | |     ) {
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

Check warning on line 588 in rar-common/src/database/options.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

field assignment outside of initializer for an instance created with Default::default()

warning: field assignment outside of initializer for an instance created with Default::default()
   --> rar-common/src/database/options.rs:588:9
    |
588 |         opt.level = Level::Global;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `database::options::Opt { level: Level::Global, root: Some(SPrivileged::User), bounding: Some(SBounding::Strict), ..Default::default() }` and removing relevant reassignments
   --> rar-common/src/database/options.rs:587:9
    |
587 |         let mut opt = Opt::default();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default

Check warning on line 480 in rar-common/src/database/options.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

stripping a prefix manually

warning: stripping a prefix manually
   --> rar-common/src/database/options.rs:480:9
    |
480 |         &tzval[1..]
    |         ^^^^^^^^^^^
    |
note: the prefix was tested here
   --> rar-common/src/database/options.rs:479:17
    |
479 |     let tzval = if tzval.starts_with(':') {
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_strip
    = note: `#[warn(clippy::manual_strip)]` on by default
help: try using the `strip_prefix` method
    |
479 ~     let tzval = if let Some(<stripped>) = tzval.strip_prefix(':') {
480 ~         <stripped>
    |

Check warning on line 437 in rar-common/src/database/options.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

field assignment outside of initializer for an instance created with Default::default()

warning: field assignment outside of initializer for an instance created with Default::default()
   --> rar-common/src/database/options.rs:437:9
    |
437 |         res.default_behavior = behavior;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `database::options::SEnvOptions { default_behavior: behavior, ..Default::default() }` and removing relevant reassignments
   --> rar-common/src/database/options.rs:436:9
    |
436 |         let mut res = SEnvOptions::default();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default