Skip to content

Refactor file creation and opening functions with privilege handling

Sign in for the full log view
GitHub Actions / clippy succeeded May 5, 2024 in 1s

clippy

136 warnings

Details

Results

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

Versions

  • rustc 1.78.0 (9b00956e5 2024-04-29)
  • cargo 1.78.0 (54d8815d0 2024-03-26)
  • clippy 0.1.78 (9b00956 2024-04-29)

Annotations

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

See this annotation in the file changed.

@github-actions github-actions / clippy

unused `std::result::Result` that must be used

warning: unused `std::result::Result` that must be used
   --> src/chsr/../database/mod.rs:142:5
    |
142 |     write_json_config(&config, path);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this `Result` may be an `Err` variant, which should be handled
    = note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
    |
142 |     let _ = write_json_config(&config, path);
    |     +++++++

Check warning on line 127 in src/chsr/../util.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
   --> src/chsr/../util.rs:127:45
    |
127 |                 format!("\"{}\"", s.replace("\"", "\\\""))
    |                                             ^^^^ help: consider using a `char`: `'"'`
    |
    = 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 556 in src/chsr/../database/structs.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

methods called `into_*` usually take `self` by value

warning: methods called `into_*` usually take `self` by value
   --> src/chsr/../database/structs.rs:556:22
    |
556 |     pub fn into_user(&self) -> Result<Option<User>, Errno> {
    |                      ^^^^^
    |
    = help: consider choosing a less ambiguous name
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention

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

See this annotation in the file changed.

@github-actions github-actions / clippy

methods called `into_*` usually take `self` by value

warning: methods called `into_*` usually take `self` by value
   --> src/chsr/../database/structs.rs:550:23
    |
550 |     pub fn into_group(&self) -> Result<Option<Group>, Errno> {
    |                       ^^^^^
    |
    = help: consider choosing a less ambiguous name
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
    = note: `#[warn(clippy::wrong_self_convention)]` on by default

Check warning on line 393 in src/chsr/../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()
   --> src/chsr/../database/structs.rs:393:9
    |
393 |         ret.name = name;
    |         ^^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `common::database::structs::STask { name: name, _role: Some(role), ..Default::default() }` and removing relevant reassignments
   --> src/chsr/../database/structs.rs:392:9
    |
392 |         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 376 in src/chsr/../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()
   --> src/chsr/../database/structs.rs:376:9
    |
376 |         ret.name = name;
    |         ^^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `common::database::structs::SRole { name: name, _config: Some(config), ..Default::default() }` and removing relevant reassignments
   --> src/chsr/../database/structs.rs:375:9
    |
375 |         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 311 in src/chsr/../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()
   --> src/chsr/../database/structs.rs:311:9
    |
311 |         c.add = capset;
    |         ^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `common::database::structs::SCapabilities { add: capset, ..Default::default() }` and removing relevant reassignments
   --> src/chsr/../database/structs.rs:310:9
    |
310 |         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 588 in src/chsr/../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
   --> src/chsr/../database/options.rs:584:10
    |
584 |       ) -> (
    |  __________^
585 | |         PathBehavior,
586 | |         Rc<RefCell<LinkedHashSet<String>>>,
587 | |         Rc<RefCell<LinkedHashSet<String>>>,
588 | |     ) {
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

Check warning on line 477 in src/chsr/../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()
   --> src/chsr/../database/options.rs:477:9
    |
477 |         opt.level = Level::Global;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `common::database::options::Opt { level: Level::Global, root: Some(SPrivileged::User), bounding: Some(SBounding::Strict), ..Default::default() }` and removing relevant reassignments
   --> src/chsr/../database/options.rs:476:9
    |
476 |         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 370 in src/chsr/../database/options.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

stripping a prefix manually

warning: stripping a prefix manually
   --> src/chsr/../database/options.rs:370:9
    |
370 |         &tzval[1..]
    |         ^^^^^^^^^^^
    |
note: the prefix was tested here
   --> src/chsr/../database/options.rs:369:17
    |
369 |     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
    |
369 ~     let tzval = if let Some(<stripped>) = tzval.strip_prefix(':') {
370 ~         <stripped>
    |

Check warning on line 339 in src/chsr/../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()
   --> src/chsr/../database/options.rs:339:9
    |
339 |         res.default_behavior = behavior;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `common::database::options::SEnvOptions { default_behavior: behavior, ..Default::default() }` and removing relevant reassignments
   --> src/chsr/../database/options.rs:338:9
    |
338 |         let mut res = SEnvOptions::default();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default

Check warning on line 319 in src/chsr/../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()
   --> src/chsr/../database/options.rs:319:9
    |
319 |         res.default_behavior = behavior;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `common::database::options::SPathOptions { default_behavior: behavior, ..Default::default() }` and removing relevant reassignments
   --> src/chsr/../database/options.rs:318:9
    |
318 |         let mut res = 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 213 in src/chsr/../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()
   --> src/chsr/../database/options.rs:213:9
    |
213 |         opt.level = level;
    |         ^^^^^^^^^^^^^^^^^^
    |
note: consider initializing the variable with `common::database::options::Opt { level: level, ..Default::default() }` and removing relevant reassignments
   --> src/chsr/../database/options.rs:212:9
    |
212 |         let mut opt = Self::default();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default

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

See this annotation in the file changed.

@github-actions github-actions / clippy

name `UID` contains a capitalized acronym

warning: name `UID` contains a capitalized acronym
  --> src/chsr/../database/options.rs:61:5
   |
61 |     UID,
   |     ^^^ help: consider making the acronym lowercase, except the initial letter: `Uid`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms

Check warning on line 60 in src/chsr/../database/options.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/chsr/../database/options.rs:60:5
   |
60 |     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

Check warning on line 59 in src/chsr/../database/options.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/chsr/../database/options.rs:59:5
   |
59 |     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 12 in src/chsr/../database/migration.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/../database/migration.rs:12:15
   |
12 |     pub down: fn(&Self, &mut T) -> 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 11 in src/chsr/../database/migration.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/../database/migration.rs:11:13
   |
11 |     pub up: fn(&Self, &mut T) -> 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 547 in src/chsr/../database/finder.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

assigning the result of `Clone::clone()` may be inefficient

warning: assigning the result of `Clone::clone()` may be inefficient
   --> src/chsr/../database/finder.rs:547:9
    |
547 |         settings.setgroups = setgid.clone();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `settings.setgroups.clone_from(setgid)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones

Check warning on line 546 in src/chsr/../database/finder.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

assigning the result of `Clone::clone()` may be inefficient

warning: assigning the result of `Clone::clone()` may be inefficient
   --> src/chsr/../database/finder.rs:546:9
    |
546 |         settings.setuid = setuid.clone();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `settings.setuid.clone_from(setuid)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones
    = note: `#[warn(clippy::assigning_clones)]` on by default

Check warning on line 104 in src/chsr/../database/finder.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

all variants have the same postfix: `Match`

warning: all variants have the same postfix: `Match`
   --> src/chsr/../database/finder.rs:100:1
    |
100 | / pub enum UserMin {
101 | |     UserMatch,
102 | |     GroupMatch(usize),
103 | |     NoMatch,
104 | | }
    | |_^
    |
    = 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

Check warning on line 255 in src/chsr/../config.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/chsr/../config.rs:253:10
    |
253 |           .inspect_err(|e| {
    |  __________^
254 | |             debug!("Error reading file: {}", e);
255 | |         })
    | |__________^
    |
    = 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 94 in src/chsr/../config.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

name `JSON` contains a capitalized acronym

warning: name `JSON` contains a capitalized acronym
  --> src/chsr/../config.rs:94:5
   |
94 |     JSON(Rc<RefCell<SConfig>>),
   |     ^^^^ help: consider making the acronym lowercase, except the initial letter: `Json`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms

Check warning on line 84 in src/chsr/../config.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

name `JSON` contains a capitalized acronym

warning: name `JSON` contains a capitalized acronym
  --> src/chsr/../config.rs:84:5
   |
84 |     JSON,
   |     ^^^^ help: consider making the acronym lowercase, except the initial letter: `Json`
   |
   = 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 142 in src/sr/../database/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused `std::result::Result` that must be used

warning: unused `std::result::Result` that must be used
   --> src/sr/../database/mod.rs:142:5
    |
142 |     write_json_config(&config, path);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this `Result` may be an `Err` variant, which should be handled
    = note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
    |
142 |     let _ = write_json_config(&config, path);
    |     +++++++