Skip to content

v3.0.0-alpha.4

v3.0.0-alpha.4 #163

GitHub Actions / clippy failed Apr 29, 2024 in 0s

clippy

2 errors, 23 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 2
Warning 23
Note 0
Help 0

Versions

  • rustc 1.77.2 (25ef9e3d8 2024-04-09)
  • cargo 1.77.2 (e52e36006 2024-03-26)
  • clippy 0.1.77 (25ef9e3 2024-04-09)

Annotations

Check warning on line 10 in src/chsr/../database/options.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `IntoEnumIterator`

warning: unused import: `IntoEnumIterator`
  --> src/chsr/../database/options.rs:10:50
   |
10 | use strum::{Display, EnumIs, EnumIter, FromRepr, IntoEnumIterator};
   |                                                  ^^^^^^^^^^^^^^^^

Check warning on line 10 in src/sr/../database/options.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `IntoEnumIterator`

warning: unused import: `IntoEnumIterator`
  --> src/sr/../database/options.rs:10:50
   |
10 | use strum::{Display, EnumIs, EnumIter, FromRepr, IntoEnumIterator};
   |                                                  ^^^^^^^^^^^^^^^^

Check warning on line 4 in src/chsr/../version.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

constants have by default a `'static` lifetime

warning: constants have by default a `'static` lifetime
 --> src/chsr/../version.rs:4:29
  |
4 | pub const PACKAGE_VERSION: &'static str = "3.0.0-alpha.4";
  |                            -^^^^^^^---- help: consider removing `'static`: `&str`
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes
  = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default

Check warning on line 9 in src/chsr/../database/version.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `crate::common::version`

warning: unused import: `crate::common::version`
 --> src/chsr/../database/version.rs:9:5
  |
9 | use crate::common::version;
  |     ^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 604 in src/chsr/../database/structs.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
   --> src/chsr/../database/structs.rs:600:24
    |
600 |                   } else {
    |  ________________________^
601 | |                     if other.iter().all(|x| groups.iter().any(|y| y == x)) {
602 | |                         return Some(Ordering::Greater);
603 | |                     }
604 | |                 }
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
    |
600 ~                 } else if other.iter().all(|x| groups.iter().any(|y| y == x)) {
601 +                     return Some(Ordering::Greater);
602 +                 }
    |

Check warning on line 589 in src/chsr/../database/structs.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
   --> src/chsr/../database/structs.rs:585:24
    |
585 |                   } else {
    |  ________________________^
586 | |                     if other.iter().any(|x| group == x) {
587 | |                         return Some(Ordering::Less);
588 | |                     }
589 | |                 }
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
    |
585 ~                 } else if other.iter().any(|x| group == x) {
586 +                     return Some(Ordering::Less);
587 +                 }
    |

Check warning on line 41 in src/chsr/../database/structs.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this seems like a manual implementation of the non-exhaustive pattern

warning: this seems like a manual implementation of the non-exhaustive pattern
  --> src/chsr/../database/structs.rs:31:1
   |
31 |   pub struct SConfig {
   |   ^-----------------
   |   |
   |  _help: add the attribute: `#[non_exhaustive] pub struct SConfig`
   | |
32 | |     #[serde(skip_serializing_if = "Option::is_none")]
33 | |     pub options: OptWrapper,
34 | |     #[serde(default, skip_serializing_if = "Vec::is_empty")]
...  |
40 | |     pub _extra_fields: Map<String, Value>,
41 | | }
   | |_^
   |
help: remove this field
  --> src/chsr/../database/structs.rs:37:5
   |
37 |     storage: (),
   |     ^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive
   = note: `#[warn(clippy::manual_non_exhaustive)]` on by default

Check warning on line 524 in src/chsr/../database/finder.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
   --> src/chsr/../database/finder.rs:516:24
    |
516 |                   } else {
    |  ________________________^
517 | |                     if groups_contains_root(setgid) {
518 | |                         SetuidMin::SetuidNotrootSetgidRoot(groups_len(setgid))
519 | |                     } else if setgid.is_none() || groups_len(setgid) == 0 {
...   |
523 | |                     }
524 | |                 }
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
    |
516 ~                 } else if groups_contains_root(setgid) {
517 +                     SetuidMin::SetuidNotrootSetgidRoot(groups_len(setgid))
518 +                 } else if setgid.is_none() || groups_len(setgid) == 0 {
519 +                     SetuidMin::Setuid
520 +                 } else {
521 +                     SetuidMin::SetuidSetgid(groups_len(setgid))
522 +                 }
    |

Check warning on line 336 in src/chsr/../database/finder.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
   --> src/chsr/../database/finder.rs:330:12
    |
330 |       } else {
    |  ____________^
331 | |         if let Some(env_path) = find_from_envpath(&path.parse().expect("The path is not valid")) {
332 | |             result = env_path
333 | |         } else {
334 | |             result = path.parse().expect("The path is not valid");
335 | |         }
336 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
    |
330 ~     } else if let Some(env_path) = find_from_envpath(&path.parse().expect("The path is not valid")) {
331 +         result = env_path
332 +     } else {
333 +         result = path.parse().expect("The path is not valid");
334 +     }
    |

Check warning on line 11 in src/chsr/../database/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `tracing::warn`

warning: unused import: `tracing::warn`
  --> src/chsr/../database/mod.rs:11:5
   |
11 | use tracing::warn;
   |     ^^^^^^^^^^^^^

Check warning on line 6 in src/chsr/../database/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `crate::rc_refcell`

warning: unused import: `crate::rc_refcell`
 --> src/chsr/../database/mod.rs:6:5
  |
6 | use crate::rc_refcell;
  |     ^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

Check warning on line 1364 in src/chsr/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
    --> src/chsr/cli.rs:1355:12
     |
1355 |       } else {
     |  ____________^
1356 | |         if options {
1357 | |             println!(
1358 | |                 "{}",
...    |
1363 | |         }
1364 | |     }
     | |_____^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
     |
1355 ~     } else if options {
1356 +         println!(
1357 +             "{}",
1358 +             serde_json::to_string_pretty(&OptStack::from_role(role.clone()).to_opt())?
1359 +         );
1360 +     } else {
1361 +         print_role(&role, &role_type.unwrap_or(RoleType::All));
1362 +     }
     |

Check warning on line 1279 in src/chsr/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
    --> src/chsr/cli.rs:1270:20
     |
1270 |               } else {
     |  ____________________^
1271 | |                 if let Some(options) = &role.as_ref().borrow_mut().options {
1272 | |                     return exec_on_opt(options.clone());
1273 | |                 } else {
...    |
1278 | |                 }
1279 | |             }
     | |_____________^
     |
     = 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
     |
1270 ~             } else if let Some(options) = &role.as_ref().borrow_mut().options {
1271 +                 return exec_on_opt(options.clone());
1272 +             } else {
1273 +                 let options = Rc::new(RefCell::new(Opt::default()));
1274 +                 let ret = exec_on_opt(options.clone());
1275 +                 role.as_ref().borrow_mut().options = Some(options);
1276 +                 return ret;
1277 +             }
     |

Check warning on line 4 in src/sr/../version.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

constants have by default a `'static` lifetime

warning: constants have by default a `'static` lifetime
 --> src/sr/../version.rs:4:29
  |
4 | pub const PACKAGE_VERSION: &'static str = "3.0.0-alpha.4";
  |                            -^^^^^^^---- help: consider removing `'static`: `&str`
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes
  = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default

Check warning on line 9 in src/sr/../database/version.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `crate::common::version`

warning: unused import: `crate::common::version`
 --> src/sr/../database/version.rs:9:5
  |
9 | use crate::common::version;
  |     ^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 604 in src/sr/../database/structs.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
   --> src/sr/../database/structs.rs:600:24
    |
600 |                   } else {
    |  ________________________^
601 | |                     if other.iter().all(|x| groups.iter().any(|y| y == x)) {
602 | |                         return Some(Ordering::Greater);
603 | |                     }
604 | |                 }
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
    |
600 ~                 } else if other.iter().all(|x| groups.iter().any(|y| y == x)) {
601 +                     return Some(Ordering::Greater);
602 +                 }
    |

Check warning on line 589 in src/sr/../database/structs.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
   --> src/sr/../database/structs.rs:585:24
    |
585 |                   } else {
    |  ________________________^
586 | |                     if other.iter().any(|x| group == x) {
587 | |                         return Some(Ordering::Less);
588 | |                     }
589 | |                 }
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
    |
585 ~                 } else if other.iter().any(|x| group == x) {
586 +                     return Some(Ordering::Less);
587 +                 }
    |

Check warning on line 41 in src/sr/../database/structs.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this seems like a manual implementation of the non-exhaustive pattern

warning: this seems like a manual implementation of the non-exhaustive pattern
  --> src/sr/../database/structs.rs:31:1
   |
31 |   pub struct SConfig {
   |   ^-----------------
   |   |
   |  _help: add the attribute: `#[non_exhaustive] pub struct SConfig`
   | |
32 | |     #[serde(skip_serializing_if = "Option::is_none")]
33 | |     pub options: OptWrapper,
34 | |     #[serde(default, skip_serializing_if = "Vec::is_empty")]
...  |
40 | |     pub _extra_fields: Map<String, Value>,
41 | | }
   | |_^
   |
help: remove this field
  --> src/sr/../database/structs.rs:37:5
   |
37 |     storage: (),
   |     ^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive
   = note: `#[warn(clippy::manual_non_exhaustive)]` on by default

Check warning on line 524 in src/sr/../database/finder.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
   --> src/sr/../database/finder.rs:516:24
    |
516 |                   } else {
    |  ________________________^
517 | |                     if groups_contains_root(setgid) {
518 | |                         SetuidMin::SetuidNotrootSetgidRoot(groups_len(setgid))
519 | |                     } else if setgid.is_none() || groups_len(setgid) == 0 {
...   |
523 | |                     }
524 | |                 }
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
    |
516 ~                 } else if groups_contains_root(setgid) {
517 +                     SetuidMin::SetuidNotrootSetgidRoot(groups_len(setgid))
518 +                 } else if setgid.is_none() || groups_len(setgid) == 0 {
519 +                     SetuidMin::Setuid
520 +                 } else {
521 +                     SetuidMin::SetuidSetgid(groups_len(setgid))
522 +                 }
    |

Check warning on line 336 in src/sr/../database/finder.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
   --> src/sr/../database/finder.rs:330:12
    |
330 |       } else {
    |  ____________^
331 | |         if let Some(env_path) = find_from_envpath(&path.parse().expect("The path is not valid")) {
332 | |             result = env_path
333 | |         } else {
334 | |             result = path.parse().expect("The path is not valid");
335 | |         }
336 | |     }
    | |_____^
    |
    = 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
    |
330 ~     } else if let Some(env_path) = find_from_envpath(&path.parse().expect("The path is not valid")) {
331 +         result = env_path
332 +     } else {
333 +         result = path.parse().expect("The path is not valid");
334 +     }
    |

Check warning on line 11 in src/sr/../database/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `tracing::warn`

warning: unused import: `tracing::warn`
  --> src/sr/../database/mod.rs:11:5
   |
11 | use tracing::warn;
   |     ^^^^^^^^^^^^^

Check warning on line 6 in src/sr/../database/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `crate::rc_refcell`

warning: unused import: `crate::rc_refcell`
 --> src/sr/../database/mod.rs:6:5
  |
6 | use crate::rc_refcell;
  |     ^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

Check failure on line 9 in src/chsr/../database/version.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the name `version` is defined multiple times

error[E0252]: the name `version` is defined multiple times
 --> src/chsr/../database/version.rs:9:5
  |
8 | use crate::common::version;
  |     ---------------------- previous import of the module `version` here
9 | use crate::common::version;
  |     ^^^^^^^^^^^^^^^^^^^^^^ `version` reimported here
  |
  = note: `version` must be defined only once in the type namespace of this module

Check failure on line 9 in src/sr/../database/version.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the name `version` is defined multiple times

error[E0252]: the name `version` is defined multiple times
 --> src/sr/../database/version.rs:9:5
  |
8 | use crate::common::version;
  |     ---------------------- previous import of the module `version` here
9 | use crate::common::version;
  |     ^^^^^^^^^^^^^^^^^^^^^^ `version` reimported here
  |
  = note: `version` must be defined only once in the type namespace of this module

Check warning on line 118 in build.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent

warning: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent
   --> build.rs:118:25
    |
118 |             let mut s = line.split("(V").nth(0).unwrap().to_string();
    |                         ^^^^^^^^^^^^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `line.split("(V").next()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_nth_zero
    = note: `#[warn(clippy::iter_nth_zero)]` on by default