Full rust rewriting and new functionnalities #137
clippy
79 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 79 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.72.0 (5680fa18f 2023-08-23)
- cargo 1.72.0 (103a7ff2e 2023-08-15)
- clippy 0.1.72 (5680fa1 2023-08-23)
Annotations
Check warning on line 323 in src/sr/main.rs
github-actions / clippy
called `.as_ref().map(|g| g.as_slice())` on an Option value. This can be done more directly by calling `groups.as_deref()` instead
warning: called `.as_ref().map(|g| g.as_slice())` on an Option value. This can be done more directly by calling `groups.as_deref()` instead
--> src/sr/main.rs:323:35
|
323 | capctl::cap_set_ids(uid, gid, groups.as_ref().map(|g| g.as_slice()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `groups.as_deref()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_as_ref_deref
= note: `#[warn(clippy::option_as_ref_deref)]` on by default
Check warning on line 296 in src/sr/main.rs
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
--> src/sr/main.rs:296:25
|
296 | User::from_name(&u)
| ^^ help: change this to: `u`
|
= 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 80 in src/sr/main.rs
github-actions / clippy
stripping a prefix manually
warning: stripping a prefix manually
--> src/sr/main.rs:80:9
|
80 | &tzval[1..]
| ^^^^^^^^^^^
|
note: the prefix was tested here
--> src/sr/main.rs:79:17
|
79 | 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
|
79 ~ let tzval = if let Some(<stripped>) = tzval.strip_prefix(':') {
80 ~ <stripped>
|
Check warning on line 58 in src/sr/timeout.rs
github-actions / clippy
name `PPID` contains a capitalized acronym
warning: name `PPID` contains a capitalized acronym
--> src/sr/timeout.rs:58:5
|
58 | 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 57 in src/sr/timeout.rs
github-actions / clippy
name `TTY` contains a capitalized acronym
warning: name `TTY` contains a capitalized acronym
--> src/sr/timeout.rs:57:5
|
57 | 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
Check warning on line 29 in src/sr/timeout.rs
github-actions / clippy
name `PPID` contains a capitalized acronym
warning: name `PPID` contains a capitalized acronym
--> src/sr/timeout.rs:29:5
|
29 | PPID,
| ^^^^ 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 27 in src/sr/timeout.rs
github-actions / clippy
name `TTY` contains a capitalized acronym
warning: name `TTY` contains a capitalized acronym
--> src/sr/timeout.rs:27:5
|
27 | TTY,
| ^^^ 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 131 in src/chsr/../config/mod.rs
github-actions / clippy
useless conversion to the same type: `sxd_document::dom::Element<'_>`
warning: useless conversion to the same type: `sxd_document::dom::Element<'_>`
--> src/chsr/../config/mod.rs:131:15
|
131 | f(element.into())?;
| ^^^^^^^^^^^^^^ help: consider removing `.into()`: `element`
|
= 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 630 in src/sr/finder.rs
github-actions / clippy
`if` chain can be rewritten with `match`
warning: `if` chain can be rewritten with `match`
--> src/sr/finder.rs:624:9
|
624 | / if nmatch == 1 {
625 | | Ok(min_task)
626 | | } else if nmatch > 1 {
627 | | Err(MatchError::Conflict)
628 | | } else {
629 | | Err(MatchError::NoMatch)
630 | | }
| |_________^
|
= help: consider rewriting the `if` chain to use `cmp` and `match`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_chain
= note: `#[warn(clippy::comparison_chain)]` on by default
Check warning on line 16 in src/chsr/../config/version.rs
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/../config/version.rs:16:11
|
16 | down: fn(&Self, &Document) -> Result<(), Box<dyn Error>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
Check warning on line 15 in src/chsr/../config/version.rs
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/../config/version.rs:15:9
|
15 | up: fn(&Self, &Document) -> 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 413 in src/chsr/../config/structs.rs
github-actions / clippy
using `clone` on type `CapSet` which implements the `Copy` trait
warning: using `clone` on type `CapSet` which implements the `Copy` trait
--> src/chsr/../config/structs.rs:413:13
|
413 | self.denied_caps.as_ref().unwrap().clone()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*self.denied_caps.as_ref().unwrap()`
|
= 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
Check warning on line 350 in src/chsr/../config/structs.rs
github-actions / clippy
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/chsr/../config/structs.rs:345:21
|
345 | / match nix::unistd::Group::from_name(group) {
346 | | Ok(Some(nixgroup)) => {
347 | | vgroups.push(nixgroup);
348 | | }
349 | | _ => (),
350 | | };
| |_____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
= note: `#[warn(clippy::single_match)]` on by default
help: try this
|
345 ~ if let Ok(Some(nixgroup)) = nix::unistd::Group::from_name(group) {
346 + vgroups.push(nixgroup);
347 ~ };
|
Check warning on line 167 in src/sr/finder.rs
github-actions / clippy
this lifetime isn't used in the impl
warning: this lifetime isn't used in the impl
--> src/sr/finder.rs:167:6
|
167 | impl<'a> Ord for Score {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
Check warning on line 161 in src/sr/finder.rs
github-actions / clippy
this lifetime isn't used in the impl
warning: this lifetime isn't used in the impl
--> src/sr/finder.rs:161:6
|
161 | impl<'a> PartialOrd for Score {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
Check warning on line 609 in src/chsr/../config/save.rs
github-actions / clippy
this creates an owned instance just for comparison
warning: this creates an owned instance just for comparison
--> src/chsr/../config/save.rs:608:35
|
608 | } else if *child.text().unwrap().text()
| ___________________________________^
609 | | != self.wildcard_denied.as_ref().unwrap().to_string()
| |_________________________________________________________________________________^ try implementing the comparison without allocating
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cmp_owned
Check warning on line 559 in src/chsr/../config/save.rs
github-actions / clippy
this creates an owned instance just for comparison
warning: this creates an owned instance just for comparison
--> src/chsr/../config/save.rs:553:35
|
553 | } else if *child
| ___________________________________^
554 | | .text()
555 | | .ok_or::<Box<dyn Error>>(
556 | | "Unable to retrieve env_checklist Text".into(),
557 | | )?
558 | | .text()
559 | | != self.env_checklist.as_ref().unwrap().to_string()
| |_______________________________________________________________________________^ try implementing the comparison without allocating
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cmp_owned
Check warning on line 542 in src/chsr/../config/save.rs
github-actions / clippy
this creates an owned instance just for comparison
warning: this creates an owned instance just for comparison
--> src/chsr/../config/save.rs:536:35
|
536 | } else if *child
| ___________________________________^
537 | | .text()
538 | | .ok_or::<Box<dyn Error>>(
539 | | "Unable to retrieve env_whitelist Text".into(),
540 | | )?
541 | | .text()
542 | | != self.env_whitelist.as_ref().unwrap().to_string()
| |_______________________________________________________________________________^ try implementing the comparison without allocating
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cmp_owned
= note: `#[warn(clippy::cmp_owned)]` on by default
Check warning on line 92 in src/sr/finder.rs
github-actions / clippy
all variants have the same postfix: `Match`
warning: all variants have the same postfix: `Match`
--> src/sr/finder.rs:88:1
|
88 | / enum UserMin {
89 | | UserMatch,
90 | | GroupMatch(usize),
91 | | NoMatch,
92 | | }
| |_^
|
= 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 44 in src/sr/finder.rs
github-actions / clippy
this lifetime isn't used in the impl
warning: this lifetime isn't used in the impl
--> src/sr/finder.rs:44:6
|
44 | impl<'a> Error for MatchError {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
Check warning on line 35 in src/sr/finder.rs
github-actions / clippy
this lifetime isn't used in the impl
warning: this lifetime isn't used in the impl
--> src/sr/finder.rs:35:6
|
35 | impl<'a> Display for MatchError {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
Check warning on line 131 in src/sr/../config/mod.rs
github-actions / clippy
useless conversion to the same type: `sxd_document::dom::Element<'_>`
warning: useless conversion to the same type: `sxd_document::dom::Element<'_>`
--> src/sr/../config/mod.rs:131:15
|
131 | f(element.into())?;
| ^^^^^^^^^^^^^^ help: consider removing `.into()`: `element`
|
= 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 268 in src/chsr/../config/load.rs
github-actions / clippy
this lifetime isn't used in the function definition
warning: this lifetime isn't used in the function definition
--> src/chsr/../config/load.rs:268:22
|
268 | pub fn load_document<'a, P>(filename: &P, validate: bool) -> Result<Package, Box<dyn Error>>
| ^^
|
= 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
Check warning on line 16 in src/sr/../config/version.rs
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/sr/../config/version.rs:16:11
|
16 | down: fn(&Self, &Document) -> Result<(), Box<dyn Error>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
Check warning on line 15 in src/sr/../config/version.rs
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/sr/../config/version.rs:15:9
|
15 | up: fn(&Self, &Document) -> 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