Skip to content

Create mdbook.yml

Create mdbook.yml #97

GitHub Actions / clippy succeeded Apr 29, 2024 in 1s

clippy

97 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 97
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 140 in src/chsr/state/role.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

accessing first element with `manager .roles .as_ref() .borrow() .roles.get(0)`

warning: accessing first element with `manager
                             .roles
                             .as_ref()
                             .borrow()
                             .roles.get(0)`
   --> src/chsr/state/role.rs:135:17
    |
135 | /                 manager
136 | |                     .roles
137 | |                     .as_ref()
138 | |                     .borrow()
139 | |                     .roles
140 | |                     .get(0)
    | |___________________________^
    |
    = 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
help: try
    |
135 ~                 manager
136 +                     .roles
137 +                     .as_ref()
138 +                     .borrow()
139 +                     .roles.first()
    |

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

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `expect` followed by a function call

warning: use of `expect` followed by a function call
   --> src/sr/main.rs:378:34
    |
378 |         setpcap_effective(false).expect(&cap_effective_error("setpcap"));
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| { panic!("{}", cap_effective_error("setpcap")) })`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call

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

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `expect` followed by a function call

warning: use of `expect` followed by a function call
   --> src/sr/main.rs:374:39
    |
374 |             capctl::bounding::clear().expect(&cap_effective_error("setpcap"));
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| { panic!("{}", cap_effective_error("setpcap")) })`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call

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

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `expect` followed by a function call

warning: use of `expect` followed by a function call
   --> src/sr/main.rs:370:34
    |
370 |         setpcap_effective(false).expect(&cap_effective_error("setpcap"));
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| { panic!("{}", cap_effective_error("setpcap")) })`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call

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

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `expect` followed by a function call

warning: use of `expect` followed by a function call
   --> src/sr/main.rs:353:29
    |
353 |     setuid_effective(false).expect(&cap_effective_error("setuid"));
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| { panic!("{}", cap_effective_error("setuid")) })`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call

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

See this annotation in the file changed.

@github-actions github-actions / clippy

called `.as_ref().map(|g| g.as_slice())` on an `Option` value

warning: called `.as_ref().map(|g| g.as_slice())` on an `Option` value
   --> src/sr/main.rs:351:35
    |
351 |     capctl::cap_set_ids(uid, gid, groups.as_ref().map(|g| g.as_slice()))
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `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 350 in src/sr/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `expect` followed by a function call

warning: use of `expect` followed by a function call
   --> src/sr/main.rs:350:28
    |
350 |     setuid_effective(true).expect(&cap_effective_error("setuid"));
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| { panic!("{}", cap_effective_error("setuid")) })`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call

Check warning on line 324 in src/sr/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
   --> src/sr/main.rs:324:25
    |
324 |         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 274 in src/sr/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `expect` followed by a function call

warning: use of `expect` followed by a function call
   --> src/sr/main.rs:274:35
    |
274 |     dac_override_effective(false).expect(&cap_effective_error("dac_override"));
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| { panic!("{}", cap_effective_error("dac_override")) })`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call

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

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `expect` followed by a function call

warning: use of `expect` followed by a function call
   --> src/sr/main.rs:263:34
    |
263 |     dac_override_effective(true).expect(&cap_effective_error("dac_override"));
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| { panic!("{}", cap_effective_error("dac_override")) })`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call

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

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `expect` followed by a function call

warning: use of `expect` followed by a function call
   --> src/sr/main.rs:224:10
    |
224 |         .expect(&cap_effective_error("dac_read_search or dac_override"));
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| { panic!("{}", cap_effective_error("dac_read_search or dac_override")) })`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call

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

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `expect` followed by a function call

warning: use of `expect` followed by a function call
   --> src/sr/main.rs:220:10
    |
220 |         .expect(&cap_effective_error("dac_read_search or dac_override"));
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| { panic!("{}", cap_effective_error("dac_read_search or dac_override")) })`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call
    = note: `#[warn(clippy::expect_fun_call)]` on by default

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

See this annotation in the file changed.

@github-actions 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 131 in src/chsr/../config/mod.rs

See this annotation in the file changed.

@github-actions 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 58 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: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

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: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 16 in src/chsr/../config/version.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/../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

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/../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 29 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: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

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: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 413 in src/chsr/../config/structs.rs

See this annotation in the file changed.

@github-actions 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

See this annotation in the file changed.

@github-actions 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
    |
345 ~                     if let Ok(Some(nixgroup)) = nix::unistd::Group::from_name(group) {
346 +                         vgroups.push(nixgroup);
347 ~                     };
    |

Check warning on line 630 in src/sr/finder.rs

See this annotation in the file changed.

@github-actions 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 609 in src/chsr/../config/save.rs

See this annotation in the file changed.

@github-actions 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

See this annotation in the file changed.

@github-actions 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