Documentation improvements, build process refactoring #185
clippy
124 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 124 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.79.0 (129f3b996 2024-06-10)
- cargo 1.79.0 (ffa9cf99a 2024-06-03)
- clippy 0.1.79 (129f3b9 2024-06-10)
Annotations
Check warning on line 122 in src/chsr/../mod.rs
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/../mod.rs:117:44
|
117 | let res = std::fs::File::create(p).inspect_err(|e| {
| ____________________________________________^
118 | | debug!(
119 | | "Error creating file without privilege, trying with privileges: {}",
120 | | e
121 | | );
122 | | });
| |__________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
Check warning on line 573 in src/chsr/../database/structs.rs
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:573:22
|
573 | 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 567 in src/chsr/../database/structs.rs
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:567:23
|
567 | 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 410 in src/chsr/../database/structs.rs
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:410:9
|
410 | 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:409:9
|
409 | 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 393 in src/chsr/../database/structs.rs
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::SRole { name: name, _config: Some(config), ..Default::default() }` and removing relevant reassignments
--> src/chsr/../database/structs.rs:392:9
|
392 | 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 328 in src/chsr/../database/structs.rs
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:328:9
|
328 | 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:327:9
|
327 | 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 902 in src/chsr/../database/options.rs
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/options.rs:902:25
|
902 | final_set = p.set.clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `final_set.clone_from(&p.set)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones
Check warning on line 880 in src/chsr/../database/options.rs
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/options.rs:880:25
|
880 | final_set = p.set.clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `final_set.clone_from(&p.set)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones
Check warning on line 853 in src/chsr/../database/options.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/../database/options.rs:847:10
|
847 | ) -> (
| __________^
848 | | EnvBehavior,
849 | | HashMap<String, String>,
850 | | LinkedHashSet<EnvKey>,
851 | | LinkedHashSet<EnvKey>,
852 | | LinkedHashSet<EnvKey>,
853 | | ) {
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
Check warning on line 718 in src/chsr/../database/options.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/../database/options.rs:714:10
|
714 | ) -> (
| __________^
715 | | PathBehavior,
716 | | Rc<RefCell<LinkedHashSet<String>>>,
717 | | Rc<RefCell<LinkedHashSet<String>>>,
718 | | ) {
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
Check warning on line 663 in src/chsr/../database/options.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/../database/options.rs:659:10
|
659 | ) -> (
| __________^
660 | | PathBehavior,
661 | | Rc<RefCell<LinkedHashSet<String>>>,
662 | | Rc<RefCell<LinkedHashSet<String>>>,
663 | | ) {
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
Check warning on line 571 in src/chsr/../database/options.rs
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:571:9
|
571 | 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:570:9
|
570 | 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 463 in src/chsr/../database/options.rs
github-actions / clippy
stripping a prefix manually
warning: stripping a prefix manually
--> src/chsr/../database/options.rs:463:9
|
463 | &tzval[1..]
| ^^^^^^^^^^^
|
note: the prefix was tested here
--> src/chsr/../database/options.rs:462:17
|
462 | 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
|
462 ~ let tzval = if let Some(<stripped>) = tzval.strip_prefix(':') {
463 ~ <stripped>
|
Check warning on line 416 in src/chsr/../database/options.rs
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:416:9
|
416 | 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:415:9
|
415 | 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 395 in src/chsr/../database/options.rs
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:395:9
|
395 | 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:394:9
|
394 | 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 276 in src/chsr/../database/options.rs
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:276:9
|
276 | timeout.type_field = Some(TimestampType::PPID);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `common::database::options::STimeout { type_field: Some(TimestampType::PPID), duration: Some(Duration::minutes(5)), ..Default::default() }` and removing relevant reassignments
--> src/chsr/../database/options.rs:275:9
|
275 | let mut timeout = STimeout::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
Check warning on line 224 in src/chsr/../database/options.rs
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:224:9
|
224 | 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:223:9
|
223 | 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 406 in src/sr/main.rs
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:402:13
|
402 | for group in res {
| ^ --- help: try: `res.flatten()`
| _____________|
| |
403 | | if let Some(group) = group {
404 | | groups.push(group.gid.as_raw());
405 | | }
406 | | }
| |_____________^
|
help: ...and remove the `if let` statement in the for loop
--> src/sr/main.rs:403:17
|
403 | / if let Some(group) = group {
404 | | groups.push(group.gid.as_raw());
405 | | }
| |_________________^
= 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 326 in src/sr/main.rs
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:326:5
|
320 | / let user = Cred {
321 | | user,
322 | | groups,
323 | | tty,
324 | | ppid,
325 | | };
| |______- unnecessary `let` binding
326 | 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
|
320 ~
321 ~ Cred {
322 + user,
323 + groups,
324 + tty,
325 + ppid,
326 + }
|
Check warning on line 281 in src/sr/main.rs
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:281:68
|
281 | 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 134 in src/chsr/../database/options.rs
github-actions / clippy
direct implementation of `ToString`
warning: direct implementation of `ToString`
--> src/chsr/../database/options.rs:130:1
|
130 | / impl ToString for EnvKey {
131 | | fn to_string(&self) -> String {
132 | | self.value.clone()
133 | | }
134 | | }
| |_^
|
= help: prefer implementing `Display` instead
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_trait_impl
= note: `#[warn(clippy::to_string_trait_impl)]` on by default
Check warning on line 218 in src/sr/main.rs
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:216:14
|
216 | .inspect_err(|e| {
| ______________^
217 | | error!("{}", e);
218 | | })
| |______________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
Check warning on line 179 in src/sr/main.rs
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:179:5
|
179 | 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 182 in src/sr/timeout.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/sr/timeout.rs:182:15
|
182 | .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 179 in src/sr/timeout.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/sr/timeout.rs:179:44
|
179 | 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