v3.0.0-alpha.4 #103
Annotations
3 errors and 242 warnings
equal expressions as operands to `==`:
src/chsr/../plugin/ssd.rs#L43
error: equal expressions as operands to `==`
--> src/chsr/../plugin/ssd.rs:43:28
|
43 | if group == group {
| ^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#eq_op
= note: `#[deny(clippy::eq_op)]` on by default
|
equal expressions as operands to `==`:
src/sr/../plugin/ssd.rs#L43
error: equal expressions as operands to `==`
--> src/sr/../plugin/ssd.rs:43:28
|
43 | if group == group {
| ^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#eq_op
= note: `#[deny(clippy::eq_op)]` on by default
|
rust-coverage
Process completed with exit code 101.
|
useless use of `vec!`:
src/chsr/../database/options.rs#L504
warning: useless use of `vec!`
--> src/chsr/../database/options.rs:504:21
|
504 | env.check = vec!["TZ".into(), "LOGNAME".into(), "LOGIN".into(), "USER".into()]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `["TZ".into(), "LOGNAME".into(), "LOGIN".into(), "USER".into()]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
= note: `#[warn(clippy::useless_vec)]` on by default
|
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`:
src/chsr/../plugin/ssd.rs#L134
warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> src/chsr/../plugin/ssd.rs:134:5
|
134 | / role._extra_fields
135 | | .get("ssd")
136 | | .and_then(|ssd| Some(serde_json::from_value::<SSD>(ssd.clone())))
| |_________________________________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
help: try
|
134 ~ role._extra_fields
135 + .get("ssd").map(|ssd| serde_json::from_value::<SSD>(ssd.clone()))
|
|
writing `&Vec` instead of `&[_]` involves a new object where a slice will do:
src/chsr/../plugin/ssd.rs#L97
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> src/chsr/../plugin/ssd.rs:97:57
|
97 | fn groups_are_forbidden(groups: &Vec<Group>, ssd_roles: &Vec<String>, sconfig: &SConfig) -> bool {
| ^^^^^^^^^^^^ help: change this to: `&[String]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
|
writing `&Vec` instead of `&[_]` involves a new object where a slice will do:
src/chsr/../plugin/ssd.rs#L72
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> src/chsr/../plugin/ssd.rs:72:46
|
72 | fn user_is_forbidden(user: &User, ssd_roles: &Vec<String>, sconfig: &SConfig) -> bool {
| ^^^^^^^^^^^^ help: change this to: `&[String]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
|
writing `&Vec` instead of `&[_]` involves a new object where a slice will do:
src/chsr/../plugin/ssd.rs#L62
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> src/chsr/../plugin/ssd.rs:62:29
|
62 | fn groups_subset_of(groups: &Vec<Group>, actors: &Vec<SActor>) -> bool {
| ^^^^^^^^^^^ help: change this to: `&[Group]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
|
writing `&Vec` instead of `&[_]` involves a new object where a slice will do:
src/chsr/../plugin/ssd.rs#L37
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> src/chsr/../plugin/ssd.rs:37:46
|
37 | fn group_contained_in(group: &Group, actors: &Vec<SActor>) -> bool {
| ^^^^^^^^^^^^ help: change this to: `&[SActor]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
|
writing `&Vec` instead of `&[_]` involves a new object where a slice will do:
src/chsr/../plugin/ssd.rs#L21
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> src/chsr/../plugin/ssd.rs:21:43
|
21 | fn user_contained_in(user: &User, actors: &Vec<SActor>) -> bool {
| ^^^^^^^^^^^^ help: change this to: `&[SActor]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: `#[warn(clippy::ptr_arg)]` on by default
|
name `SSD` contains a capitalized acronym:
src/chsr/../plugin/ssd.rs#L19
warning: name `SSD` contains a capitalized acronym
--> src/chsr/../plugin/ssd.rs:19:12
|
19 | pub struct SSD(Vec<String>);
| ^^^ help: consider making the acronym lowercase, except the initial letter: `Ssd`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms
|
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`:
src/chsr/../plugin/hierarchy.rs#L18
warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> src/chsr/../plugin/hierarchy.rs:18:5
|
18 | / role._extra_fields
19 | | .get("parents")
20 | | .and_then(|parents| Some(serde_json::from_value::<Parents>(parents.clone())))
| |_____________________________________________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
help: try
|
18 ~ role._extra_fields
19 + .get("parents").map(|parents| serde_json::from_value::<Parents>(parents.clone()))
|
|
the borrowed expression implements the required traits:
src/chsr/../plugin/hashchecker.rs#L79
warning: the borrowed expression implements the required traits
--> src/chsr/../plugin/hashchecker.rs:79:50
|
79 | &String::from_utf8(std::fs::read(&path)?)?,
| ^^^^^ help: change this to: `path`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../plugin/hashchecker.rs#L69
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../plugin/hashchecker.rs:69:53
|
69 | let opath = find_executable_in_path(&command);
| ^^^^^^^^ help: change this to: `command`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
unneeded `return` statement:
src/chsr/../plugin/hashchecker.rs#L77
warning: unneeded `return` statement
--> src/chsr/../plugin/hashchecker.rs:77:13
|
77 | / return if compute(
78 | | &checker.hash_type,
79 | | &String::from_utf8(std::fs::read(&path)?)?,
80 | | ) == compute(&checker.hash_type, &checker.hash)
... |
84 | | Err("Hashes do not match".into())
85 | | };
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
77 ~ if compute(
78 + &checker.hash_type,
79 + &String::from_utf8(std::fs::read(&path)?)?,
80 + ) == compute(&checker.hash_type, &checker.hash)
81 + {
82 + parse_conf_command(&checker.command)
83 + } else {
84 + Err("Hashes do not match".into())
85 ~ }
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/mod.rs#L34
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/mod.rs:34:67
|
34 | task.as_ref().borrow_mut()._role = Some(Rc::downgrade(&role));
| ^^^^^ help: change this to: `role`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/mod.rs#L32
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/mod.rs:32:65
|
32 | role.as_ref().borrow_mut()._config = Some(Rc::downgrade(&config));
| ^^^^^^^ help: change this to: `config`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`:
src/chsr/../database/version.rs#L51
warning: in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
--> src/chsr/../database/version.rs:51:23
|
51 | .and_then(|b| {
| _______________________^
52 | | intermediate.version = version::PACKAGE_VERSION.to_owned().parse()?;
53 | | debug!("Migrated from {}", intermediate.version);
54 | | Ok(b)
55 | | })
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_conditions
= note: `#[warn(clippy::blocks_in_conditions)]` on by default
|
an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true:
src/chsr/../database/structs.rs#L611
warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
--> src/chsr/../database/structs.rs:611:1
|
611 | impl Into<Vec<Group>> for SGroups {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
help: replace the `Into` implementation with `From<common::database::structs::SGroups>`
|
611 ~ impl From<SGroups> for Vec<Group> {
612 ~ fn from(val: SGroups) -> Self {
613 ~ match val {
|
|
`if` chain can be rewritten with `match`:
src/chsr/../database/structs.rs#L592
warning: `if` chain can be rewritten with `match`
--> src/chsr/../database/structs.rs:592:17
|
592 | / if groups.len() == other.len() {
593 | | if groups.iter().all(|x| other.iter().any(|y| x == y)) {
594 | | return Some(Ordering::Equal);
595 | | }
... |
603 | | }
604 | | }
| |_________________^
|
= 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
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/structs.rs#L564
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/structs.rs:564:55
|
564 | SActorType::Name(name) => User::from_name(&name),
| ^^^^^ help: change this to: `name`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
methods called `into_*` usually take `self` by value:
src/chsr/../database/structs.rs#L562
warning: methods called `into_*` usually take `self` by value
--> src/chsr/../database/structs.rs:562:22
|
562 | 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
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/structs.rs#L558
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/structs.rs:558:56
|
558 | SActorType::Name(name) => Group::from_name(&name),
| ^^^^^ help: change this to: `name`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
methods called `into_*` usually take `self` by value:
src/chsr/../database/structs.rs#L556
warning: methods called `into_*` usually take `self` by value
--> src/chsr/../database/structs.rs:556:23
|
556 | 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
|
an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true:
src/chsr/../database/structs.rs#L546
warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
--> src/chsr/../database/structs.rs:546:1
|
546 | impl Into<Vec<SActorType>> for SGroups {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
help: replace the `Into` implementation with `From<common::database::structs::SGroups>`
|
546 ~ impl From<SGroups> for Vec<SActorType> {
547 ~ fn from(val: SGroups) -> Self {
548 ~ match val {
|
|
using `Result.and_then(|x| Ok(y))`, which is more succinctly expressed as `map(|x| y)`:
src/chsr/../database/structs.rs#L477
warning: using `Result.and_then(|x| Ok(y))`, which is more succinctly expressed as `map(|x| y)`
--> src/chsr/../database/structs.rs:477:35
|
477 | SActorType::Id(id) => other
| ___________________________________^
478 | | .parse()
479 | | .and_then(|oid: u32| Ok(oid == *id))
| |____________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
help: try
|
477 ~ SActorType::Id(id) => other
478 + .parse().map(|oid: u32| oid == *id)
|
|
field assignment outside of initializer for an instance created with Default::default():
src/chsr/../database/structs.rs#L396
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/chsr/../database/structs.rs:396:9
|
396 | 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:395:9
|
395 | let mut ret = STask::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
|
field assignment outside of initializer for an instance created with Default::default():
src/chsr/../database/structs.rs#L379
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/chsr/../database/structs.rs:379:9
|
379 | 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:378:9
|
378 | let mut ret = SRole::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
|
field assignment outside of initializer for an instance created with Default::default():
src/chsr/../database/structs.rs#L314
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/chsr/../database/structs.rs:314:9
|
314 | 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:313:9
|
313 | let mut c = SCapabilities::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
|
this `impl` can be derived:
src/chsr/../database/structs.rs#L260
warning: this `impl` can be derived
--> src/chsr/../database/structs.rs:260:1
|
260 | / impl Default for SetBehavior {
261 | | fn default() -> Self {
262 | | SetBehavior::None
263 | | }
264 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= help: remove the manual implementation...
help: ...and instead derive it...
|
149 + #[derive(Default)]
150 | pub enum SetBehavior {
|
help: ...and mark the default variant
|
151 ~ #[default]
152 ~ None,
|
|
useless use of `vec!`:
src/sr/../database/options.rs#L504
warning: useless use of `vec!`
--> src/sr/../database/options.rs:504:21
|
504 | env.check = vec!["TZ".into(), "LOGNAME".into(), "LOGIN".into(), "USER".into()]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `["TZ".into(), "LOGNAME".into(), "LOGIN".into(), "USER".into()]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
= note: `#[warn(clippy::useless_vec)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/main.rs#L419
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/main.rs:419:43
|
419 | timeout::update_cookie(&user, &user, &timeout)?;
| ^^^^^ help: change this to: `user`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/main.rs#L419
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/main.rs:419:36
|
419 | timeout::update_cookie(&user, &user, &timeout)?;
| ^^^^^ help: change this to: `user`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/main.rs#L404
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/main.rs:404:54
|
404 | Storage::JSON(_) => timeout::is_valid(&user, &user, &timeout),
| ^^^^^ help: change this to: `user`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/main.rs#L404
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/main.rs:404:47
|
404 | Storage::JSON(_) => timeout::is_valid(&user, &user, &timeout),
| ^^^^^ help: change this to: `user`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
use of `expect` followed by a function call:
src/sr/main.rs#L364
warning: use of `expect` followed by a function call
--> src/sr/main.rs:364:34
|
364 | 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
|
use of `expect` followed by a function call:
src/sr/main.rs#L358
warning: use of `expect` followed by a function call
--> src/sr/main.rs:358:33
|
358 | setpcap_effective(true).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
|
use of `expect` followed by a function call:
src/sr/main.rs#L356
warning: use of `expect` followed by a function call
--> src/sr/main.rs:356:34
|
356 | 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
|
use of `expect` followed by a function call:
src/sr/main.rs#L343
warning: use of `expect` followed by a function call
--> src/sr/main.rs:343:33
|
343 | setpcap_effective(true).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
|
use of `expect` followed by a function call:
src/sr/main.rs#L339
warning: use of `expect` followed by a function call
--> src/sr/main.rs:339:29
|
339 | 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
|
use of `expect` followed by a function call:
src/sr/main.rs#L338
warning: use of `expect` followed by a function call
--> src/sr/main.rs:338:29
|
338 | setgid_effective(false).expect(&cap_effective_error("setgid"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| { panic!("{}", cap_effective_error("setgid")) })`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call
|
called `.as_ref().map(|g| g.as_slice())` on an `Option` value:
src/sr/main.rs#L336
warning: called `.as_ref().map(|g| g.as_slice())` on an `Option` value
--> src/sr/main.rs:336:35
|
336 | 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
|
use of `expect` followed by a function call:
src/sr/main.rs#L335
warning: use of `expect` followed by a function call
--> src/sr/main.rs:335:28
|
335 | 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
|
use of `expect` followed by a function call:
src/sr/main.rs#L334
warning: use of `expect` followed by a function call
--> src/sr/main.rs:334:28
|
334 | setgid_effective(true).expect(&cap_effective_error("setgid"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| { panic!("{}", cap_effective_error("setgid")) })`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call
|
unnecessary `if let` since only the `Some` variant of the iterator element is used:
src/sr/main.rs#L325
warning: unnecessary `if let` since only the `Some` variant of the iterator element is used
--> src/sr/main.rs:325:13
|
325 | for group in res {
| ^ --- help: try: `res.flatten()`
| _____________|
| |
326 | | if let Some(group) = group {
327 | | groups.push(group.gid.as_raw());
328 | | }
329 | | }
| |_____________^
|
help: ...and remove the `if let` statement in the for loop
--> src/sr/main.rs:326:17
|
326 | / if let Some(group) = group {
327 | | groups.push(group.gid.as_raw());
328 | | }
| |_________________^
= 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
|
accessing first element with `g.get(0)`:
src/sr/main.rs#L305
warning: accessing first element with `g.get(0)`
--> src/sr/main.rs:305:23
|
305 | let res = g.get(0).unwrap().into_group().unwrap_or(None);
| ^^^^^^^^ help: try: `g.first()`
|
= 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
|
`to_string` applied to a type that implements `Display` in `println!` args:
src/sr/main.rs#L267
warning: `to_string` applied to a type that implements `Display` in `println!` args
--> src/sr/main.rs:267:50
|
267 | execcfg.task().as_ref().borrow().name.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
|
use of `expect` followed by a function call:
src/sr/main.rs#L252
warning: use of `expect` followed by a function call
--> src/sr/main.rs:252:35
|
252 | 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
|
use of `expect` followed by a function call:
src/sr/main.rs#L234
warning: use of `expect` followed by a function call
--> src/sr/main.rs:234:34
|
234 | 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
|
use of `expect` followed by a function call:
src/sr/main.rs#L196
warning: use of `expect` followed by a function call
--> src/sr/main.rs:196:27
|
196 | read_effective(false).expect(&cap_effective_error("dac_read"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| { panic!("{}", cap_effective_error("dac_read")) })`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call
|
use of `expect` followed by a function call:
src/sr/main.rs#L194
warning: use of `expect` followed by a function call
--> src/sr/main.rs:194:26
|
194 | read_effective(true).expect(&cap_effective_error("dac_read"));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| { panic!("{}", cap_effective_error("dac_read")) })`
|
= 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
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/main.rs#L182
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/main.rs:182:22
|
182 | .matches(&user, &args.command)
| ^^^^^ help: change this to: `user`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/main.rs#L178
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/main.rs:178:17
|
178 | &role,
| ^^^^^ help: change this to: `role`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/main.rs#L174
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/main.rs:174:22
|
174 | .matches(&user, &args.command)
| ^^^^^ help: change this to: `user`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/main.rs#L172
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/main.rs:172:19
|
172 | .role(&role)
| ^^^^^ help: change this to: `role`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/main.rs#L170
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/main.rs:170:40
|
170 | (None, None) => config.matches(&user, &args.command).map_err(|m| m.into()),
| ^^^^^ help: change this to: `user`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/options.rs#L772
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/options.rs:772:65
|
772 | ... .filter(|e| !p.keep.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/options.rs#L767
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/options.rs:767:93
|
767 | ... .filter(|e| !p.keep.env_matches(&e) || !p.check.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/options.rs#L767
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/options.rs:767:65
|
767 | ... .filter(|e| !p.keep.env_matches(&e) || !p.check.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/options.rs#L761
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/options.rs:761:67
|
761 | ... .filter(|e| !p.delete.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/options.rs#L756
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/options.rs:756:95
|
756 | ... .filter(|e| !p.delete.env_matches(&e) || !p.check.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/options.rs#L756
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/options.rs:756:67
|
756 | ... .filter(|e| !p.delete.env_matches(&e) || !p.check.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/options.rs#L747
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/options.rs:747:61
|
747 | ... .filter(|e| !p.keep.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/options.rs#L742
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/options.rs:742:89
|
742 | ... .filter(|e| !p.keep.env_matches(&e) || !p.check.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/options.rs#L742
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/options.rs:742:61
|
742 | ... .filter(|e| !p.keep.env_matches(&e) || !p.check.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/options.rs#L733
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/options.rs:733:63
|
733 | ... .filter(|e| !p.delete.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/options.rs#L728
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/options.rs:728:62
|
728 | ... .filter(|e| !p.check.env_matches(&e) || !p.delete.env_matches(e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
name `PPID` contains a capitalized acronym:
src/sr/timeout.rs#L35
warning: name `PPID` contains a capitalized acronym
--> src/sr/timeout.rs:35:5
|
35 | 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
|
name `TTY` contains a capitalized acronym:
src/sr/timeout.rs#L34
warning: name `TTY` contains a capitalized acronym
--> src/sr/timeout.rs:34:5
|
34 | 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
|
very complex type used. Consider factoring parts into `type` definitions:
src/chsr/../database/options.rs#L607
warning: very complex type used. Consider factoring parts into `type` definitions
--> src/chsr/../database/options.rs:607:10
|
607 | ) -> (
| __________^
608 | | PathBehavior,
609 | | Rc<RefCell<LinkedHashSet<String>>>,
610 | | Rc<RefCell<LinkedHashSet<String>>>,
611 | | ) {
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
|
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`:
src/sr/../plugin/ssd.rs#L134
warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> src/sr/../plugin/ssd.rs:134:5
|
134 | / role._extra_fields
135 | | .get("ssd")
136 | | .and_then(|ssd| Some(serde_json::from_value::<SSD>(ssd.clone())))
| |_________________________________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
help: try
|
134 ~ role._extra_fields
135 + .get("ssd").map(|ssd| serde_json::from_value::<SSD>(ssd.clone()))
|
|
single-character string constant used as pattern:
src/chsr/../database/options.rs#L590
warning: single-character string constant used as pattern
--> src/chsr/../database/options.rs:590:24
|
590 | .split(":")
| ^^^ help: consider using a `char`: `':'`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
|
writing `&Vec` instead of `&[_]` involves a new object where a slice will do:
src/sr/../plugin/ssd.rs#L97
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> src/sr/../plugin/ssd.rs:97:57
|
97 | fn groups_are_forbidden(groups: &Vec<Group>, ssd_roles: &Vec<String>, sconfig: &SConfig) -> bool {
| ^^^^^^^^^^^^ help: change this to: `&[String]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
|
writing `&Vec` instead of `&[_]` involves a new object where a slice will do:
src/sr/../plugin/ssd.rs#L72
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> src/sr/../plugin/ssd.rs:72:46
|
72 | fn user_is_forbidden(user: &User, ssd_roles: &Vec<String>, sconfig: &SConfig) -> bool {
| ^^^^^^^^^^^^ help: change this to: `&[String]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
|
writing `&Vec` instead of `&[_]` involves a new object where a slice will do:
src/sr/../plugin/ssd.rs#L62
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> src/sr/../plugin/ssd.rs:62:29
|
62 | fn groups_subset_of(groups: &Vec<Group>, actors: &Vec<SActor>) -> bool {
| ^^^^^^^^^^^ help: change this to: `&[Group]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
|
writing `&Vec` instead of `&[_]` involves a new object where a slice will do:
src/sr/../plugin/ssd.rs#L37
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> src/sr/../plugin/ssd.rs:37:46
|
37 | fn group_contained_in(group: &Group, actors: &Vec<SActor>) -> bool {
| ^^^^^^^^^^^^ help: change this to: `&[SActor]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
|
writing `&Vec` instead of `&[_]` involves a new object where a slice will do:
src/sr/../plugin/ssd.rs#L21
warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
--> src/sr/../plugin/ssd.rs:21:43
|
21 | fn user_contained_in(user: &User, actors: &Vec<SActor>) -> bool {
| ^^^^^^^^^^^^ help: change this to: `&[SActor]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: `#[warn(clippy::ptr_arg)]` on by default
|
field assignment outside of initializer for an instance created with Default::default():
src/chsr/../database/options.rs#L500
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/chsr/../database/options.rs:500:9
|
500 | 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:499:9
|
499 | let mut opt = Opt::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
|
name `SSD` contains a capitalized acronym:
src/sr/../plugin/ssd.rs#L19
warning: name `SSD` contains a capitalized acronym
--> src/sr/../plugin/ssd.rs:19:12
|
19 | pub struct SSD(Vec<String>);
| ^^^ help: consider making the acronym lowercase, except the initial letter: `Ssd`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms
|
stripping a prefix manually:
src/chsr/../database/options.rs#L393
warning: stripping a prefix manually
--> src/chsr/../database/options.rs:393:9
|
393 | &tzval[1..]
| ^^^^^^^^^^^
|
note: the prefix was tested here
--> src/chsr/../database/options.rs:392:17
|
392 | 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
|
392 ~ let tzval = if let Some(<stripped>) = tzval.strip_prefix(':') {
393 ~ <stripped>
|
|
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`:
src/sr/../plugin/hierarchy.rs#L18
warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> src/sr/../plugin/hierarchy.rs:18:5
|
18 | / role._extra_fields
19 | | .get("parents")
20 | | .and_then(|parents| Some(serde_json::from_value::<Parents>(parents.clone())))
| |_____________________________________________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
help: try
|
18 ~ role._extra_fields
19 + .get("parents").map(|parents| serde_json::from_value::<Parents>(parents.clone()))
|
|
single-character string constant used as pattern:
src/chsr/../database/options.rs#L379
warning: single-character string constant used as pattern
--> src/chsr/../database/options.rs:379:50
|
379 | wildcarded.value.replace("*", ".*").replace("?", ".")
| ^^^ help: consider using a `char`: `'*'`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
|
single-character string constant used as pattern:
src/chsr/../database/options.rs#L379
warning: single-character string constant used as pattern
--> src/chsr/../database/options.rs:379:69
|
379 | wildcarded.value.replace("*", ".*").replace("?", ".")
| ^^^ help: consider using a `char`: `'?'`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
|
field assignment outside of initializer for an instance created with Default::default():
src/chsr/../database/options.rs#L362
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/chsr/../database/options.rs:362:9
|
362 | 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:361:9
|
361 | let mut res = SEnvOptions::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
|
field assignment outside of initializer for an instance created with Default::default():
src/chsr/../database/options.rs#L342
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/chsr/../database/options.rs:342:9
|
342 | 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:341:9
|
341 | let mut res = SPathOptions::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
|
the borrowed expression implements the required traits:
src/sr/../plugin/hashchecker.rs#L79
warning: the borrowed expression implements the required traits
--> src/sr/../plugin/hashchecker.rs:79:50
|
79 | &String::from_utf8(std::fs::read(&path)?)?,
| ^^^^^ help: change this to: `path`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../plugin/hashchecker.rs#L69
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../plugin/hashchecker.rs:69:53
|
69 | let opath = find_executable_in_path(&command);
| ^^^^^^^^ help: change this to: `command`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true:
src/chsr/../database/options.rs#L311
warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
--> src/chsr/../database/options.rs:311:1
|
311 | impl Into<String> for EnvKey {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
= note: `#[warn(clippy::from_over_into)]` on by default
help: replace the `Into` implementation with `From<common::database::options::EnvKey>`
|
311 ~ impl From<EnvKey> for String {
312 ~ fn from(val: EnvKey) -> Self {
313 ~ val.value
|
|
unneeded `return` statement:
src/sr/../plugin/hashchecker.rs#L77
warning: unneeded `return` statement
--> src/sr/../plugin/hashchecker.rs:77:13
|
77 | / return if compute(
78 | | &checker.hash_type,
79 | | &String::from_utf8(std::fs::read(&path)?)?,
80 | | ) == compute(&checker.hash_type, &checker.hash)
... |
84 | | Err("Hashes do not match".into())
85 | | };
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
|
77 ~ if compute(
78 + &checker.hash_type,
79 + &String::from_utf8(std::fs::read(&path)?)?,
80 + ) == compute(&checker.hash_type, &checker.hash)
81 + {
82 + parse_conf_command(&checker.command)
83 + } else {
84 + Err("Hashes do not match".into())
85 ~ }
|
|
field assignment outside of initializer for an instance created with Default::default():
src/chsr/../database/options.rs#L237
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/chsr/../database/options.rs:237:9
|
237 | 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:236:9
|
236 | let mut opt = Self::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
|
this `impl` can be derived:
src/chsr/../database/options.rs#L228
warning: this `impl` can be derived
--> src/chsr/../database/options.rs:228:1
|
228 | / impl Default for PathBehavior {
229 | | fn default() -> Self {
230 | | PathBehavior::Inherit
231 | | }
232 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= help: remove the manual implementation...
help: ...and instead derive it...
|
43 + #[derive(Default)]
44 | pub enum PathBehavior {
|
help: ...and mark the default variant
|
47 ~ #[default]
48 ~ Inherit,
|
|
this `impl` can be derived:
src/chsr/../database/options.rs#L222
warning: this `impl` can be derived
--> src/chsr/../database/options.rs:222:1
|
222 | / impl Default for SPrivileged {
223 | | fn default() -> Self {
224 | | SPrivileged::User
225 | | }
226 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= help: remove the manual implementation...
help: ...and instead derive it...
|
175 + #[derive(Default)]
176 | pub enum SPrivileged {
|
help: ...and mark the default variant
|
177 ~ #[default]
178 ~ User,
|
|
this `impl` can be derived:
src/chsr/../database/options.rs#L216
warning: this `impl` can be derived
--> src/chsr/../database/options.rs:216:1
|
216 | / impl Default for SBounding {
217 | | fn default() -> Self {
218 | | SBounding::Inherit
219 | | }
220 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= help: remove the manual implementation...
help: ...and instead derive it...
|
167 + #[derive(Default)]
168 | pub enum SBounding {
|
help: ...and mark the default variant
|
170 ~ #[default]
171 ~ Inherit,
|
|
this `impl` can be derived:
src/chsr/../database/options.rs#L210
warning: this `impl` can be derived
--> src/chsr/../database/options.rs:210:1
|
210 | / impl Default for EnvBehavior {
211 | | fn default() -> Self {
212 | | EnvBehavior::Inherit
213 | | }
214 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= help: remove the manual implementation...
help: ...and instead derive it...
|
116 + #[derive(Default)]
117 | pub enum EnvBehavior {
|
help: ...and mark the default variant
|
119 ~ #[default]
120 ~ Inherit,
|
|
this `impl` can be derived:
src/chsr/../database/options.rs#L204
warning: this `impl` can be derived
--> src/chsr/../database/options.rs:204:1
|
204 | / impl Default for Level {
205 | | fn default() -> Self {
206 | | Level::Default
207 | | }
208 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= help: remove the manual implementation...
help: ...and instead derive it...
|
23 + #[derive(Default)]
24 | pub enum Level {
|
help: ...and mark the default variant
|
25 ~ #[default]
26 ~ Default,
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/mod.rs#L34
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/mod.rs:34:67
|
34 | task.as_ref().borrow_mut()._role = Some(Rc::downgrade(&role));
| ^^^^^ help: change this to: `role`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/mod.rs#L32
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/mod.rs:32:65
|
32 | role.as_ref().borrow_mut()._config = Some(Rc::downgrade(&config));
| ^^^^^^^ help: change this to: `config`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`:
src/sr/../database/version.rs#L51
warning: in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
--> src/sr/../database/version.rs:51:23
|
51 | .and_then(|b| {
| _______________________^
52 | | intermediate.version = version::PACKAGE_VERSION.to_owned().parse()?;
53 | | debug!("Migrated from {}", intermediate.version);
54 | | Ok(b)
55 | | })
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_conditions
= note: `#[warn(clippy::blocks_in_conditions)]` on by default
|
this `impl` can be derived:
src/chsr/../database/options.rs#L58
warning: this `impl` can be derived
--> src/chsr/../database/options.rs:58:1
|
58 | / impl Default for TimestampType {
59 | | fn default() -> Self {
60 | | TimestampType::PPID
61 | | }
62 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= note: `#[warn(clippy::derivable_impls)]` on by default
= help: remove the manual implementation...
help: ...and instead derive it...
|
52 + #[derive(Default)]
53 | pub enum TimestampType {
|
help: ...and mark the default variant
|
53 ~ #[default]
54 ~ PPID,
|
|
an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true:
src/sr/../database/structs.rs#L611
warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
--> src/sr/../database/structs.rs:611:1
|
611 | impl Into<Vec<Group>> for SGroups {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
help: replace the `Into` implementation with `From<common::database::structs::SGroups>`
|
611 ~ impl From<SGroups> for Vec<Group> {
612 ~ fn from(val: SGroups) -> Self {
613 ~ match val {
|
|
`if` chain can be rewritten with `match`:
src/sr/../database/structs.rs#L592
warning: `if` chain can be rewritten with `match`
--> src/sr/../database/structs.rs:592:17
|
592 | / if groups.len() == other.len() {
593 | | if groups.iter().all(|x| other.iter().any(|y| x == y)) {
594 | | return Some(Ordering::Equal);
595 | | }
... |
603 | | }
604 | | }
| |_________________^
|
= 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
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/structs.rs#L564
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/structs.rs:564:55
|
564 | SActorType::Name(name) => User::from_name(&name),
| ^^^^^ help: change this to: `name`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
methods called `into_*` usually take `self` by value:
src/sr/../database/structs.rs#L562
warning: methods called `into_*` usually take `self` by value
--> src/sr/../database/structs.rs:562:22
|
562 | 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
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/structs.rs#L558
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/structs.rs:558:56
|
558 | SActorType::Name(name) => Group::from_name(&name),
| ^^^^^ help: change this to: `name`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
name `UID` contains a capitalized acronym:
src/chsr/../database/options.rs#L55
warning: name `UID` contains a capitalized acronym
--> src/chsr/../database/options.rs:55:5
|
55 | 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
|
name `TTY` contains a capitalized acronym:
src/chsr/../database/options.rs#L54
warning: name `TTY` contains a capitalized acronym
--> src/chsr/../database/options.rs:54:5
|
54 | 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
|
name `PPID` contains a capitalized acronym:
src/chsr/../database/options.rs#L53
warning: name `PPID` contains a capitalized acronym
--> src/chsr/../database/options.rs:53:5
|
53 | 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
|
methods called `into_*` usually take `self` by value:
src/sr/../database/structs.rs#L556
warning: methods called `into_*` usually take `self` by value
--> src/sr/../database/structs.rs:556:23
|
556 | 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
|
an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true:
src/sr/../database/structs.rs#L546
warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
--> src/sr/../database/structs.rs:546:1
|
546 | impl Into<Vec<SActorType>> for SGroups {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
help: replace the `Into` implementation with `From<common::database::structs::SGroups>`
|
546 ~ impl From<SGroups> for Vec<SActorType> {
547 ~ fn from(val: SGroups) -> Self {
548 ~ match val {
|
|
using `Result.and_then(|x| Ok(y))`, which is more succinctly expressed as `map(|x| y)`:
src/sr/../database/structs.rs#L477
warning: using `Result.and_then(|x| Ok(y))`, which is more succinctly expressed as `map(|x| y)`
--> src/sr/../database/structs.rs:477:35
|
477 | SActorType::Id(id) => other
| ___________________________________^
478 | | .parse()
479 | | .and_then(|oid: u32| Ok(oid == *id))
| |____________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
help: try
|
477 ~ SActorType::Id(id) => other
478 + .parse().map(|oid: u32| oid == *id)
|
|
field assignment outside of initializer for an instance created with Default::default():
src/sr/../database/structs.rs#L396
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/sr/../database/structs.rs:396:9
|
396 | 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/sr/../database/structs.rs:395:9
|
395 | let mut ret = STask::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
|
field assignment outside of initializer for an instance created with Default::default():
src/sr/../database/structs.rs#L379
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/sr/../database/structs.rs:379:9
|
379 | 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/sr/../database/structs.rs:378:9
|
378 | let mut ret = SRole::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/migration.rs#L131
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/migration.rs:131:13
|
131 | &version,
| ^^^^^^^^ help: change this to: `version`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
field assignment outside of initializer for an instance created with Default::default():
src/sr/../database/structs.rs#L314
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/sr/../database/structs.rs:314:9
|
314 | c.add = capset;
| ^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `common::database::structs::SCapabilities { add: capset, ..Default::default() }` and removing relevant reassignments
--> src/sr/../database/structs.rs:313:9
|
313 | let mut c = SCapabilities::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
|
this `impl` can be derived:
src/sr/../database/structs.rs#L260
warning: this `impl` can be derived
--> src/sr/../database/structs.rs:260:1
|
260 | / impl Default for SetBehavior {
261 | | fn default() -> Self {
262 | | SetBehavior::None
263 | | }
264 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= help: remove the manual implementation...
help: ...and instead derive it...
|
149 + #[derive(Default)]
150 | pub enum SetBehavior {
|
help: ...and mark the default variant
|
151 ~ #[default]
152 ~ None,
|
|
very complex type used. Consider factoring parts into `type` definitions:
src/chsr/../database/migration.rs#L12
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
|
very complex type used. Consider factoring parts into `type` definitions:
src/chsr/../database/migration.rs#L11
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
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/finder.rs#L592
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/finder.rs:592:37
|
592 | min_score = get_cmd_min(&input_command, &self.add);
| ^^^^^^^^^^^^^^ help: change this to: `input_command`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/../database/finder.rs#L584
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/../database/finder.rs:584:40
|
584 | let is_forbidden = get_cmd_min(&input_command, &self.sub);
| ^^^^^^^^^^^^^^ help: change this to: `input_command`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`:
src/chsr/../database/finder.rs#L550
warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> src/chsr/../database/finder.rs:550:22
|
550 | let capset = self
| ______________________^
551 | | .as_ref()
552 | | .borrow()
553 | | .cred
554 | | .capabilities
555 | | .as_ref()
556 | | .and_then(|caps| Some(caps.to_capset()));
| |____________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
= note: `#[warn(clippy::bind_instead_of_map)]` on by default
help: try
|
550 ~ let capset = self
551 + .as_ref()
552 + .borrow()
553 + .cred
554 + .capabilities
555 ~ .as_ref().map(|caps| caps.to_capset());
|
|
all variants have the same postfix: `Match`:
src/chsr/../database/finder.rs#L100
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
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/options.rs#L772
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/options.rs:772:65
|
772 | ... .filter(|e| !p.keep.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/options.rs#L767
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/options.rs:767:93
|
767 | ... .filter(|e| !p.keep.env_matches(&e) || !p.check.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/options.rs#L767
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/options.rs:767:65
|
767 | ... .filter(|e| !p.keep.env_matches(&e) || !p.check.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/options.rs#L761
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/options.rs:761:67
|
761 | ... .filter(|e| !p.delete.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/options.rs#L756
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/options.rs:756:95
|
756 | ... .filter(|e| !p.delete.env_matches(&e) || !p.check.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/options.rs#L756
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/options.rs:756:67
|
756 | ... .filter(|e| !p.delete.env_matches(&e) || !p.check.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/options.rs#L747
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/options.rs:747:61
|
747 | ... .filter(|e| !p.keep.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/options.rs#L742
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/options.rs:742:89
|
742 | ... .filter(|e| !p.keep.env_matches(&e) || !p.check.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/options.rs#L742
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/options.rs:742:61
|
742 | ... .filter(|e| !p.keep.env_matches(&e) || !p.check.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/options.rs#L733
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/options.rs:733:63
|
733 | ... .filter(|e| !p.delete.env_matches(&e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/options.rs#L728
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/options.rs:728:62
|
728 | ... .filter(|e| !p.check.env_matches(&e) || !p.delete.env_matches(e))
| ^^ help: change this to: `e`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
very complex type used. Consider factoring parts into `type` definitions:
src/sr/../database/options.rs#L607
warning: very complex type used. Consider factoring parts into `type` definitions
--> src/sr/../database/options.rs:607:10
|
607 | ) -> (
| __________^
608 | | PathBehavior,
609 | | Rc<RefCell<LinkedHashSet<String>>>,
610 | | Rc<RefCell<LinkedHashSet<String>>>,
611 | | ) {
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
|
single-character string constant used as pattern:
src/sr/../database/options.rs#L590
warning: single-character string constant used as pattern
--> src/sr/../database/options.rs:590:24
|
590 | .split(":")
| ^^^ help: consider using a `char`: `':'`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
|
field assignment outside of initializer for an instance created with Default::default():
src/sr/../database/options.rs#L500
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/sr/../database/options.rs:500:9
|
500 | 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/sr/../database/options.rs:499:9
|
499 | let mut opt = Opt::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
|
stripping a prefix manually:
src/sr/../database/options.rs#L393
warning: stripping a prefix manually
--> src/sr/../database/options.rs:393:9
|
393 | &tzval[1..]
| ^^^^^^^^^^^
|
note: the prefix was tested here
--> src/sr/../database/options.rs:392:17
|
392 | 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
|
392 ~ let tzval = if let Some(<stripped>) = tzval.strip_prefix(':') {
393 ~ <stripped>
|
|
single-character string constant used as pattern:
src/sr/../database/options.rs#L379
warning: single-character string constant used as pattern
--> src/sr/../database/options.rs:379:50
|
379 | wildcarded.value.replace("*", ".*").replace("?", ".")
| ^^^ help: consider using a `char`: `'*'`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
|
single-character string constant used as pattern:
src/sr/../database/options.rs#L379
warning: single-character string constant used as pattern
--> src/sr/../database/options.rs:379:69
|
379 | wildcarded.value.replace("*", ".*").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
|
field assignment outside of initializer for an instance created with Default::default():
src/sr/../database/options.rs#L362
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/sr/../database/options.rs:362:9
|
362 | res.default_behavior = behavior;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `common::database::options::SEnvOptions { default_behavior: behavior, ..Default::default() }` and removing relevant reassignments
--> src/sr/../database/options.rs:361:9
|
361 | let mut res = SEnvOptions::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
|
field assignment outside of initializer for an instance created with Default::default():
src/sr/../database/options.rs#L342
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/sr/../database/options.rs:342:9
|
342 | res.default_behavior = behavior;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `common::database::options::SPathOptions { default_behavior: behavior, ..Default::default() }` and removing relevant reassignments
--> src/sr/../database/options.rs:341:9
|
341 | let mut res = SPathOptions::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
|
an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true:
src/sr/../database/options.rs#L311
warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
--> src/sr/../database/options.rs:311:1
|
311 | impl Into<String> for EnvKey {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into
= note: `#[warn(clippy::from_over_into)]` on by default
help: replace the `Into` implementation with `From<common::database::options::EnvKey>`
|
311 ~ impl From<EnvKey> for String {
312 ~ fn from(val: EnvKey) -> Self {
313 ~ val.value
|
|
field assignment outside of initializer for an instance created with Default::default():
src/sr/../database/options.rs#L237
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/sr/../database/options.rs:237:9
|
237 | opt.level = level;
| ^^^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `common::database::options::Opt { level: level, ..Default::default() }` and removing relevant reassignments
--> src/sr/../database/options.rs:236:9
|
236 | let mut opt = Self::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
= note: `#[warn(clippy::field_reassign_with_default)]` on by default
|
this `impl` can be derived:
src/sr/../database/options.rs#L228
warning: this `impl` can be derived
--> src/sr/../database/options.rs:228:1
|
228 | / impl Default for PathBehavior {
229 | | fn default() -> Self {
230 | | PathBehavior::Inherit
231 | | }
232 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= help: remove the manual implementation...
help: ...and instead derive it...
|
43 + #[derive(Default)]
44 | pub enum PathBehavior {
|
help: ...and mark the default variant
|
47 ~ #[default]
48 ~ Inherit,
|
|
this `impl` can be derived:
src/sr/../database/options.rs#L222
warning: this `impl` can be derived
--> src/sr/../database/options.rs:222:1
|
222 | / impl Default for SPrivileged {
223 | | fn default() -> Self {
224 | | SPrivileged::User
225 | | }
226 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= help: remove the manual implementation...
help: ...and instead derive it...
|
175 + #[derive(Default)]
176 | pub enum SPrivileged {
|
help: ...and mark the default variant
|
177 ~ #[default]
178 ~ User,
|
|
this `impl` can be derived:
src/sr/../database/options.rs#L216
warning: this `impl` can be derived
--> src/sr/../database/options.rs:216:1
|
216 | / impl Default for SBounding {
217 | | fn default() -> Self {
218 | | SBounding::Inherit
219 | | }
220 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= help: remove the manual implementation...
help: ...and instead derive it...
|
167 + #[derive(Default)]
168 | pub enum SBounding {
|
help: ...and mark the default variant
|
170 ~ #[default]
171 ~ Inherit,
|
|
this `impl` can be derived:
src/sr/../database/options.rs#L210
warning: this `impl` can be derived
--> src/sr/../database/options.rs:210:1
|
210 | / impl Default for EnvBehavior {
211 | | fn default() -> Self {
212 | | EnvBehavior::Inherit
213 | | }
214 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= help: remove the manual implementation...
help: ...and instead derive it...
|
116 + #[derive(Default)]
117 | pub enum EnvBehavior {
|
help: ...and mark the default variant
|
119 ~ #[default]
120 ~ Inherit,
|
|
this `impl` can be derived:
src/sr/../database/options.rs#L204
warning: this `impl` can be derived
--> src/sr/../database/options.rs:204:1
|
204 | / impl Default for Level {
205 | | fn default() -> Self {
206 | | Level::Default
207 | | }
208 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= help: remove the manual implementation...
help: ...and instead derive it...
|
23 + #[derive(Default)]
24 | pub enum Level {
|
help: ...and mark the default variant
|
25 ~ #[default]
26 ~ Default,
|
|
name `JSON` contains a capitalized acronym:
src/chsr/../config.rs#L81
warning: name `JSON` contains a capitalized acronym
--> src/chsr/../config.rs:81:5
|
81 | 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
|
name `JSON` contains a capitalized acronym:
src/chsr/../config.rs#L71
warning: name `JSON` contains a capitalized acronym
--> src/chsr/../config.rs:71:5
|
71 | 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
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/chsr/cli.rs#L1362
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/chsr/cli.rs:1362:24
|
1362 | print_role(&role, &role_type.unwrap_or(RoleType::All));
| ^^^^^ help: change this to: `role`
|
= 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
|
unneeded `return` statement:
src/chsr/cli.rs#L1281
warning: unneeded `return` statement
--> src/chsr/cli.rs:1281:13
|
1281 | return Err("Role not found".into());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
1281 - return Err("Role not found".into());
1281 + Err("Role not found".into())
|
|
unneeded `return` statement:
src/chsr/cli.rs#L1277
warning: unneeded `return` statement
--> src/chsr/cli.rs:1277:21
|
1277 | return ret;
| ^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
1277 - return ret;
1277 + ret
|
|
unneeded `return` statement:
src/chsr/cli.rs#L1272
warning: unneeded `return` statement
--> src/chsr/cli.rs:1272:21
|
1272 | return exec_on_opt(options.clone());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
1272 - return exec_on_opt(options.clone());
1272 + exec_on_opt(options.clone())
|
|
unneeded `return` statement:
src/chsr/cli.rs#L1268
warning: unneeded `return` statement
--> src/chsr/cli.rs:1268:21
|
1268 | return Err("Task not found".into());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
1268 - return Err("Task not found".into());
1268 + Err("Task not found".into())
|
|
unneeded `return` statement:
src/chsr/cli.rs#L1265
warning: unneeded `return` statement
--> src/chsr/cli.rs:1265:25
|
1265 | return ret;
| ^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
1265 - return ret;
1265 + ret
|
|
unneeded `return` statement:
src/chsr/cli.rs#L1260
warning: unneeded `return` statement
--> src/chsr/cli.rs:1260:25
|
1260 | return exec_on_opt(options.clone());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
1260 - return exec_on_opt(options.clone());
1260 + exec_on_opt(options.clone())
|
|
single-character string constant used as pattern:
src/chsr/cli.rs#L1170
warning: single-character string constant used as pattern
--> src/chsr/cli.rs:1170:59
|
1170 | ... path.sub = options_path.split(":").map(|s| s.to_string()).collect();
| ^^^ help: consider using a `char`: `':'`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
|
single-character string constant used as pattern:
src/chsr/cli.rs#L1167
warning: single-character string constant used as pattern
--> src/chsr/cli.rs:1167:59
|
1167 | ... path.add = options_path.split(":").map(|s| s.to_string()).collect();
| ^^^ 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
|
using `clone` on type `SBounding` which implements the `Copy` trait:
src/chsr/cli.rs#L1128
warning: using `clone` on type `SBounding` which implements the `Copy` trait
--> src/chsr/cli.rs:1128:63
|
1128 | opt.as_ref().borrow_mut().bounding = Some(options_bounding.clone());
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `options_bounding`
|
= 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
|
field assignment outside of initializer for an instance created with Default::default():
src/chsr/cli.rs#L1094
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/chsr/cli.rs:1094:21
|
1094 | env.default_behavior = EnvBehavior::Delete;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `common::database::options::SEnvOptions { default_behavior: EnvBehavior::Delete, keep: options_env.clone(), ..Default::default() }` and removing relevant reassignments
--> src/chsr/cli.rs:1093:21
|
1093 | let mut env = SEnvOptions::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
= note: `#[warn(clippy::field_reassign_with_default)]` on by default
|
unneeded `return` statement:
src/chsr/cli.rs#L898
warning: unneeded `return` statement
--> src/chsr/cli.rs:898:25
|
898 | return Err(e);
| ^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
898 - return Err(e);
898 + Err(e)
|
|
unneeded `return` statement:
src/chsr/cli.rs#L895
warning: unneeded `return` statement
--> src/chsr/cli.rs:895:25
|
895 | return Ok(true);
| ^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
|
895 - return Ok(true);
895 + Ok(true)
|
|
this `impl` can be derived:
src/sr/../database/options.rs#L58
warning: this `impl` can be derived
--> src/sr/../database/options.rs:58:1
|
58 | / impl Default for TimestampType {
59 | | fn default() -> Self {
60 | | TimestampType::PPID
61 | | }
62 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= note: `#[warn(clippy::derivable_impls)]` on by default
= help: remove the manual implementation...
help: ...and instead derive it...
|
52 + #[derive(Default)]
53 | pub enum TimestampType {
|
help: ...and mark the default variant
|
53 ~ #[default]
54 ~ PPID,
|
|
name `UID` contains a capitalized acronym:
src/sr/../database/options.rs#L55
warning: name `UID` contains a capitalized acronym
--> src/sr/../database/options.rs:55:5
|
55 | 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
|
name `TTY` contains a capitalized acronym:
src/sr/../database/options.rs#L54
warning: name `TTY` contains a capitalized acronym
--> src/sr/../database/options.rs:54:5
|
54 | 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
|
name `PPID` contains a capitalized acronym:
src/sr/../database/options.rs#L53
warning: name `PPID` contains a capitalized acronym
--> src/sr/../database/options.rs:53:5
|
53 | 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
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/migration.rs#L131
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/migration.rs:131:13
|
131 | &version,
| ^^^^^^^^ help: change this to: `version`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent:
src/chsr/cli.rs#L401
warning: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent
--> src/chsr/cli.rs:401:21
|
401 | pair.clone().into_inner().nth(0).unwrap().as_str(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `pair.clone().into_inner().next()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_nth_zero
|
called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent:
src/chsr/cli.rs#L343
warning: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent
--> src/chsr/cli.rs:343:39
|
343 | Duration::try_seconds(reversed.nth(0).unwrap().parse::<i64>().unwrap_or(0))
| ^^^^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `reversed.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
|
very complex type used. Consider factoring parts into `type` definitions:
src/sr/../database/migration.rs#L12
warning: very complex type used. Consider factoring parts into `type` definitions
--> src/sr/../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
|
very complex type used. Consider factoring parts into `type` definitions:
src/sr/../database/migration.rs#L11
warning: very complex type used. Consider factoring parts into `type` definitions
--> src/sr/../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
|
all variants have the same postfix: `List`:
src/chsr/cli.rs#L193
warning: all variants have the same postfix: `List`
--> src/chsr/cli.rs:193:1
|
193 | / enum SetListType {
194 | | WhiteList,
195 | | BlackList,
196 | | CheckList,
197 | | }
| |_^
|
= 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
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/finder.rs#L592
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/finder.rs:592:37
|
592 | min_score = get_cmd_min(&input_command, &self.add);
| ^^^^^^^^^^^^^^ help: change this to: `input_command`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
|
this expression creates a reference which is immediately dereferenced by the compiler:
src/sr/../database/finder.rs#L584
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/../database/finder.rs:584:40
|
584 | let is_forbidden = get_cmd_min(&input_command, &self.sub);
| ^^^^^^^^^^^^^^ help: change this to: `input_command`
|
= 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
|
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`:
src/sr/../database/finder.rs#L550
warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> src/sr/../database/finder.rs:550:22
|
550 | let capset = self
| ______________________^
551 | | .as_ref()
552 | | .borrow()
553 | | .cred
554 | | .capabilities
555 | | .as_ref()
556 | | .and_then(|caps| Some(caps.to_capset()));
| |____________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
= note: `#[warn(clippy::bind_instead_of_map)]` on by default
help: try
|
550 ~ let capset = self
551 + .as_ref()
552 + .borrow()
553 + .cred
554 + .capabilities
555 ~ .as_ref().map(|caps| caps.to_capset());
|
|
all variants have the same postfix: `Match`:
src/sr/../database/finder.rs#L100
warning: all variants have the same postfix: `Match`
--> src/sr/../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
= note: `#[warn(clippy::enum_variant_names)]` on by default
|
function `capset_to_vec` is never used:
src/chsr/../util.rs#L85
warning: function `capset_to_vec` is never used
--> src/chsr/../util.rs:85:8
|
85 | pub fn capset_to_vec(set: &capctl::CapSet) -> Vec<String> {
| ^^^^^^^^^^^^^
|
function `capset_to_string` is never used:
src/chsr/../util.rs#L75
warning: function `capset_to_string` is never used
--> src/chsr/../util.rs:75:8
|
75 | pub fn capset_to_string(set: &CapSet) -> String {
| ^^^^^^^^^^^^^^^^
|
associated function `deserialize` is never used:
src/chsr/../database/version.rs#L38
warning: associated function `deserialize` is never used
--> src/chsr/../database/version.rs:38:12
|
37 | impl Versioning<SConfig> {
| ------------------------ associated function in this implementation
38 | pub fn deserialize<'de, D>(deserializer: D) -> Result<SConfig, D::Error>
| ^^^^^^^^^^^
|
associated functions `from_user_id`, `from_group_string`, `from_group_id`, `from_group_vec_string`, and `from_group_vec_id` are never used:
src/chsr/../database/structs.rs#L630
warning: associated functions `from_user_id`, `from_group_string`, `from_group_id`, `from_group_vec_string`, and `from_group_vec_id` are never used
--> src/chsr/../database/structs.rs:630:12
|
623 | impl SActor {
| ----------- associated functions in this implementation
...
630 | pub fn from_user_id(id: u32) -> Self {
| ^^^^^^^^^^^^
...
636 | pub fn from_group_string(group: &str) -> Self {
| ^^^^^^^^^^^^^^^^^
...
642 | pub fn from_group_id(id: u32) -> Self {
| ^^^^^^^^^^^^^
...
648 | pub fn from_group_vec_string(group: Vec<&str>) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^
...
656 | pub fn from_group_vec_id(groups: Vec<u32>) -> Self {
| ^^^^^^^^^^^^^^^^^
|
method `into_user` is never used:
src/chsr/../database/structs.rs#L562
warning: method `into_user` is never used
--> src/chsr/../database/structs.rs:562:12
|
555 | impl SActorType {
| --------------- method in this implementation
...
562 | pub fn into_user(&self) -> Result<Option<User>, Errno> {
| ^^^^^^^^^
|
method `config` is never used:
src/chsr/../database/structs.rs#L383
warning: method `config` is never used
--> src/chsr/../database/structs.rs:383:12
|
376 | impl SRole {
| ---------- method in this implementation
...
383 | pub fn config(&self) -> Option<Rc<RefCell<SConfig>>> {
| ^^^^^^
|
multiple methods are never used:
src/chsr/../database/options.rs#L519
warning: multiple methods are never used
--> src/chsr/../database/options.rs:519:8
|
453 | impl OptStack {
| ------------- methods in this implementation
...
519 | fn save(&mut self) {
| ^^^^
...
546 | fn get_opt(&self, level: Level) -> Option<Rc<RefCell<Opt>>> {
| ^^^^^^^
...
550 | fn find_in_options<F: Fn(&Opt) -> Option<(Level, V)>, V>(&self, f: F) -> Option<(Level, V)> {
| ^^^^^^^^^^^^^^^
...
571 | fn calculate_path(&self) -> String {
| ^^^^^^^^^^^^^^
...
675 | pub fn calculate_filtered_env(&self) -> Result<LinkedHashSet<(String, String)>, String> {
| ^^^^^^^^^^^^^^^^^^^^^^
...
783 | pub fn get_root_behavior(&self) -> (Level, SPrivileged) {
| ^^^^^^^^^^^^^^^^^
...
792 | pub fn get_bounding(&self) -> (Level, SBounding) {
| ^^^^^^^^^^^^
...
801 | pub fn get_wildcard(&self) -> (Level, String) {
| ^^^^^^^^^^^^
...
811 | pub fn get_timeout(&self) -> (Level, STimeout) {
| ^^^^^^^^^^^
...
821 | fn get_lowest_level(&self) -> Level {
| ^^^^^^^^^^^^^^^^
|
function `check_env` is never used:
src/chsr/../database/options.rs#L438
warning: function `check_env` is never used
--> src/chsr/../database/options.rs:438:4
|
438 | fn check_env(key: &str, value: &str) -> bool {
| ^^^^^^^^^
|
function `tz_is_safe` is never used:
src/chsr/../database/options.rs#L390
warning: function `tz_is_safe` is never used
--> src/chsr/../database/options.rs:390:4
|
390 | fn tz_is_safe(tzval: &str) -> bool {
| ^^^^^^^^^^
|
associated function `new` is never used:
src/chsr/../database/options.rs#L340
warning: associated function `new` is never used
--> src/chsr/../database/options.rs:340:8
|
339 | impl SPathOptions {
| ----------------- associated function in this implementation
340 | fn new(behavior: PathBehavior) -> Self {
| ^^^
|
variant `None` is never constructed:
src/chsr/../database/options.rs#L24
warning: variant `None` is never constructed
--> src/chsr/../database/options.rs:24:5
|
23 | pub enum Level {
| ----- variant in this enum
24 | None,
| ^^^^
|
= note: `Level` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis
|
methods `task` and `role` are never used:
src/chsr/../database/finder.rs#L85
warning: methods `task` and `role` are never used
--> src/chsr/../database/finder.rs:85:12
|
72 | impl ExecSettings {
| ----------------- methods in this implementation
...
85 | pub fn task(&self) -> Rc<RefCell<STask>> {
| ^^^^
...
89 | pub fn role(&self) -> Rc<RefCell<SRole>> {
| ^^^^
|
multiple associated functions are never used:
src/chsr/../api.rs#L101
warning: multiple associated functions are never used
--> src/chsr/../api.rs:101:12
|
83 | impl PluginManager {
| ------------------ associated functions in this implementation
...
101 | pub fn subscribe_task_matcher(plugin: TaskMatcher) {
| ^^^^^^^^^^^^^^^^^^^^^^
...
105 | pub fn subscribe_user_matcher(plugin: UserMatcher) {
| ^^^^^^^^^^^^^^^^^^^^^^
...
113 | pub fn subscribe_task_separation(plugin: TaskSeparation) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
...
117 | pub fn subscribe_caps_filter(plugin: CapsFilter) {
| ^^^^^^^^^^^^^^^^^^^^^
...
121 | pub fn subscribe_privilege_checker(plugin: ExecutionChecker) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
148 | pub fn notify_task_matcher(
| ^^^^^^^^^^^^^^^^^^^
...
187 | pub fn notify_task_separation(task: &STask, actor: &Cred) -> PluginResult {
| ^^^^^^^^^^^^^^^^^^^^^^
...
198 | pub fn notify_caps_filter(task: &STask, capabilities: &mut CapSet) -> PluginResultAction {
| ^^^^^^^^^^^^^^^^^^
...
210 | pub fn notify_privilege_checker(user: &Cred, exec: &mut ExecSettings) -> PluginResult {
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
fields `task_matcher_plugins`, `task_separation_plugins`, `caps_filter_plugins`, and `execution_checker_plugins` are never read:
src/chsr/../api.rs#L74
warning: fields `task_matcher_plugins`, `task_separation_plugins`, `caps_filter_plugins`, and `execution_checker_plugins` are never read
--> src/chsr/../api.rs:74:5
|
72 | pub struct PluginManager {
| ------------- fields in this struct
73 | role_matcher_plugins: Vec<RoleMatcher>,
74 | task_matcher_plugins: Vec<TaskMatcher>,
| ^^^^^^^^^^^^^^^^^^^^
...
77 | task_separation_plugins: Vec<TaskSeparation>,
| ^^^^^^^^^^^^^^^^^^^^^^^
78 | caps_filter_plugins: Vec<CapsFilter>,
| ^^^^^^^^^^^^^^^^^^^
79 | execution_checker_plugins: Vec<ExecutionChecker>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
type alias `TaskInformation` is never used:
src/chsr/../api.rs#L53
warning: type alias `TaskInformation` is never used
--> src/chsr/../api.rs:53:10
|
53 | pub type TaskInformation = fn(task: &STask) -> Option<String>;
| ^^^^^^^^^^^^^^^
|
type alias `ActorInformation` is never used:
src/chsr/../api.rs#L52
warning: type alias `ActorInformation` is never used
--> src/chsr/../api.rs:52:10
|
52 | pub type ActorInformation = fn(actor: &SActor) -> Option<String>;
| ^^^^^^^^^^^^^^^^
|
type alias `RoleInformation` is never used:
src/chsr/../api.rs#L51
warning: type alias `RoleInformation` is never used
--> src/chsr/../api.rs:51:10
|
51 | pub type RoleInformation = fn(role: &SRole) -> Option<String>;
| ^^^^^^^^^^^^^^^
|
type alias `ConfigLoaded` is never used:
src/chsr/../api.rs#L34
warning: type alias `ConfigLoaded` is never used
--> src/chsr/../api.rs:34:10
|
34 | pub type ConfigLoaded = fn(config: &SConfig);
| ^^^^^^^^^^^^
|
variant `Override` is never constructed:
src/chsr/../api.rs#L23
warning: variant `Override` is never constructed
--> src/chsr/../api.rs:23:5
|
22 | pub enum PluginResultAction {
| ------------------ variant in this enum
23 | Override, // The result of this plugin ends the algorithm to return the plugin result
| ^^^^^^^^
|
= note: `PluginResultAction` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
|
function `activates_no_new_privs` is never used:
src/chsr/../mod.rs#L92
warning: function `activates_no_new_privs` is never used
--> src/chsr/../mod.rs:92:8
|
92 | pub fn activates_no_new_privs() -> Result<(), capctl::Error> {
| ^^^^^^^^^^^^^^^^^^^^^^
|
function `setgid_effective` is never used:
src/chsr/../mod.rs#L76
warning: function `setgid_effective` is never used
--> src/chsr/../mod.rs:76:8
|
76 | pub fn setgid_effective(enable: bool) -> Result<(), capctl::Error> {
| ^^^^^^^^^^^^^^^^
|
function `setuid_effective` is never used:
src/chsr/../mod.rs#L72
warning: function `setuid_effective` is never used
--> src/chsr/../mod.rs:72:8
|
72 | pub fn setuid_effective(enable: bool) -> Result<(), capctl::Error> {
| ^^^^^^^^^^^^^^^^
|
function `setpcap_effective` is never used:
src/chsr/../mod.rs#L68
warning: function `setpcap_effective` is never used
--> src/chsr/../mod.rs:68:8
|
68 | pub fn setpcap_effective(enable: bool) -> Result<(), capctl::Error> {
| ^^^^^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
|
unused variable: `syslog`:
src/chsr/../mod.rs#L20
warning: unused variable: `syslog`
--> src/chsr/../mod.rs:20:9
|
20 | let syslog = syslog_tracing::Syslog::new(identity, options, facility).unwrap();
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_syslog`
|
= note: `#[warn(unused_variables)]` on by default
|
name `JSON` contains a capitalized acronym:
src/sr/../config.rs#L81
warning: name `JSON` contains a capitalized acronym
--> src/sr/../config.rs:81:5
|
81 | 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
|
name `JSON` contains a capitalized acronym:
src/sr/../config.rs#L71
warning: name `JSON` contains a capitalized acronym
--> src/sr/../config.rs:71:5
|
71 | 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
|
function `capset_to_vec` is never used:
src/sr/../util.rs#L85
warning: function `capset_to_vec` is never used
--> src/sr/../util.rs:85:8
|
85 | pub fn capset_to_vec(set: &capctl::CapSet) -> Vec<String> {
| ^^^^^^^^^^^^^
|
function `capset_to_string` is never used:
src/sr/../util.rs#L75
warning: function `capset_to_string` is never used
--> src/sr/../util.rs:75:8
|
75 | pub fn capset_to_string(set: &CapSet) -> String {
| ^^^^^^^^^^^^^^^^
|
associated function `deserialize` is never used:
src/sr/../database/version.rs#L38
warning: associated function `deserialize` is never used
--> src/sr/../database/version.rs:38:12
|
37 | impl Versioning<SConfig> {
| ------------------------ associated function in this implementation
38 | pub fn deserialize<'de, D>(deserializer: D) -> Result<SConfig, D::Error>
| ^^^^^^^^^^^
|
multiple associated functions are never used:
src/sr/../database/structs.rs#L624
warning: multiple associated functions are never used
--> src/sr/../database/structs.rs:624:12
|
623 | impl SActor {
| ----------- associated functions in this implementation
624 | pub fn from_user_string(user: &str) -> Self {
| ^^^^^^^^^^^^^^^^
...
630 | pub fn from_user_id(id: u32) -> Self {
| ^^^^^^^^^^^^
...
636 | pub fn from_group_string(group: &str) -> Self {
| ^^^^^^^^^^^^^^^^^
...
642 | pub fn from_group_id(id: u32) -> Self {
| ^^^^^^^^^^^^^
...
648 | pub fn from_group_vec_string(group: Vec<&str>) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^
...
656 | pub fn from_group_vec_id(groups: Vec<u32>) -> Self {
| ^^^^^^^^^^^^^^^^^
...
664 | pub fn from_group_vec_actors(groups: Vec<SActorType>) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^
|
associated function `new` is never used:
src/sr/../database/structs.rs#L394
warning: associated function `new` is never used
--> src/sr/../database/structs.rs:394:12
|
393 | impl STask {
| ---------- associated function in this implementation
394 | pub fn new(name: IdTask, role: Weak<RefCell<SRole>>) -> Self {
| ^^^
|
associated items `new` and `config` are never used:
src/sr/../database/structs.rs#L377
warning: associated items `new` and `config` are never used
--> src/sr/../database/structs.rs:377:12
|
376 | impl SRole {
| ---------- associated items in this implementation
377 | pub fn new(name: String, config: Weak<RefCell<SConfig>>) -> Self {
| ^^^
...
383 | pub fn config(&self) -> Option<Rc<RefCell<SConfig>>> {
| ^^^^^^
|
methods `save`, `get_opt`, `get_wildcard`, `get_lowest_level`, and `to_opt` are never used:
src/sr/../database/options.rs#L519
warning: methods `save`, `get_opt`, `get_wildcard`, `get_lowest_level`, and `to_opt` are never used
--> src/sr/../database/options.rs:519:8
|
453 | impl OptStack {
| ------------- methods in this implementation
...
519 | fn save(&mut self) {
| ^^^^
...
546 | fn get_opt(&self, level: Level) -> Option<Rc<RefCell<Opt>>> {
| ^^^^^^^
...
801 | pub fn get_wildcard(&self) -> (Level, String) {
| ^^^^^^^^^^^^
...
821 | fn get_lowest_level(&self) -> Level {
| ^^^^^^^^^^^^^^^^
...
831 | pub fn to_opt(&self) -> Opt {
| ^^^^^^
|
associated function `new` is never used:
src/sr/../database/options.rs#L340
warning: associated function `new` is never used
--> src/sr/../database/options.rs:340:8
|
339 | impl SPathOptions {
| ----------------- associated function in this implementation
340 | fn new(behavior: PathBehavior) -> Self {
| ^^^
|
multiple associated functions are never used:
src/sr/../api.rs#L101
warning: multiple associated functions are never used
--> src/sr/../api.rs:101:12
|
83 | impl PluginManager {
| ------------------ associated functions in this implementation
...
101 | pub fn subscribe_task_matcher(plugin: TaskMatcher) {
| ^^^^^^^^^^^^^^^^^^^^^^
...
105 | pub fn subscribe_user_matcher(plugin: UserMatcher) {
| ^^^^^^^^^^^^^^^^^^^^^^
...
113 | pub fn subscribe_task_separation(plugin: TaskSeparation) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
...
117 | pub fn subscribe_caps_filter(plugin: CapsFilter) {
| ^^^^^^^^^^^^^^^^^^^^^
...
121 | pub fn subscribe_privilege_checker(plugin: ExecutionChecker) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
148 | pub fn notify_task_matcher(
| ^^^^^^^^^^^^^^^^^^^
...
187 | pub fn notify_task_separation(task: &STask, actor: &Cred) -> PluginResult {
| ^^^^^^^^^^^^^^^^^^^^^^
...
198 | pub fn notify_caps_filter(task: &STask, capabilities: &mut CapSet) -> PluginResultAction {
| ^^^^^^^^^^^^^^^^^^
...
210 | pub fn notify_privilege_checker(user: &Cred, exec: &mut ExecSettings) -> PluginResult {
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
fields `task_matcher_plugins`, `task_separation_plugins`, `caps_filter_plugins`, and `execution_checker_plugins` are never read:
src/sr/../api.rs#L74
warning: fields `task_matcher_plugins`, `task_separation_plugins`, `caps_filter_plugins`, and `execution_checker_plugins` are never read
--> src/sr/../api.rs:74:5
|
72 | pub struct PluginManager {
| ------------- fields in this struct
73 | role_matcher_plugins: Vec<RoleMatcher>,
74 | task_matcher_plugins: Vec<TaskMatcher>,
| ^^^^^^^^^^^^^^^^^^^^
...
77 | task_separation_plugins: Vec<TaskSeparation>,
| ^^^^^^^^^^^^^^^^^^^^^^^
78 | caps_filter_plugins: Vec<CapsFilter>,
| ^^^^^^^^^^^^^^^^^^^
79 | execution_checker_plugins: Vec<ExecutionChecker>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
type alias `TaskInformation` is never used:
src/sr/../api.rs#L53
warning: type alias `TaskInformation` is never used
--> src/sr/../api.rs:53:10
|
53 | pub type TaskInformation = fn(task: &STask) -> Option<String>;
| ^^^^^^^^^^^^^^^
|
type alias `ActorInformation` is never used:
src/sr/../api.rs#L52
warning: type alias `ActorInformation` is never used
--> src/sr/../api.rs:52:10
|
52 | pub type ActorInformation = fn(actor: &SActor) -> Option<String>;
| ^^^^^^^^^^^^^^^^
|
type alias `RoleInformation` is never used:
src/sr/../api.rs#L51
warning: type alias `RoleInformation` is never used
--> src/sr/../api.rs:51:10
|
51 | pub type RoleInformation = fn(role: &SRole) -> Option<String>;
| ^^^^^^^^^^^^^^^
|
type alias `ConfigLoaded` is never used:
src/sr/../api.rs#L34
warning: type alias `ConfigLoaded` is never used
--> src/sr/../api.rs:34:10
|
34 | pub type ConfigLoaded = fn(config: &SConfig);
| ^^^^^^^^^^^^
|
variant `Override` is never constructed:
src/sr/../api.rs#L23
warning: variant `Override` is never constructed
--> src/sr/../api.rs:23:5
|
22 | pub enum PluginResultAction {
| ------------------ variant in this enum
23 | Override, // The result of this plugin ends the algorithm to return the plugin result
| ^^^^^^^^
|
= note: `PluginResultAction` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
= note: `#[warn(dead_code)]` on by default
|
unused variable: `syslog`:
src/sr/../mod.rs#L20
warning: unused variable: `syslog`
--> src/sr/../mod.rs:20:9
|
20 | let syslog = syslog_tracing::Syslog::new(identity, options, facility).unwrap();
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_syslog`
|
= note: `#[warn(unused_variables)]` on by default
|
unused import: `IntoEnumIterator`:
src/chsr/../database/options.rs#L10
warning: unused import: `IntoEnumIterator`
--> src/chsr/../database/options.rs:10:50
|
10 | use strum::{Display, EnumIs, EnumIter, FromRepr, IntoEnumIterator};
| ^^^^^^^^^^^^^^^^
|
unused import: `IntoEnumIterator`:
src/sr/../database/options.rs#L10
warning: unused import: `IntoEnumIterator`
--> src/sr/../database/options.rs:10:50
|
10 | use strum::{Display, EnumIs, EnumIter, FromRepr, IntoEnumIterator};
| ^^^^^^^^^^^^^^^^
|
constants have by default a `'static` lifetime:
src/chsr/../version.rs#L4
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
|
this `else { if .. }` block can be collapsed:
src/chsr/../database/structs.rs#L600
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 + }
|
|
this `else { if .. }` block can be collapsed:
src/chsr/../database/structs.rs#L585
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 + }
|
|
this seems like a manual implementation of the non-exhaustive pattern:
src/chsr/../database/structs.rs#L31
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
|
this `else { if .. }` block can be collapsed:
src/chsr/../database/finder.rs#L516
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 + }
|
|
this `else { if .. }` block can be collapsed:
src/chsr/../database/finder.rs#L330
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 + }
|
|
unused import: `tracing::warn`:
src/chsr/../database/mod.rs#L11
warning: unused import: `tracing::warn`
--> src/chsr/../database/mod.rs:11:5
|
11 | use tracing::warn;
| ^^^^^^^^^^^^^
|
unused import: `crate::rc_refcell`:
src/chsr/../database/mod.rs#L6
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
|
this `else { if .. }` block can be collapsed:
src/chsr/cli.rs#L1355
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 + }
|
|
this `else { if .. }` block can be collapsed:
src/chsr/cli.rs#L1270
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 + }
|
|
constants have by default a `'static` lifetime:
src/sr/../version.rs#L4
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
|
this `else { if .. }` block can be collapsed:
src/sr/../database/structs.rs#L600
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 + }
|
|
this `else { if .. }` block can be collapsed:
src/sr/../database/structs.rs#L585
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 + }
|
|
this seems like a manual implementation of the non-exhaustive pattern:
src/sr/../database/structs.rs#L31
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
|
this `else { if .. }` block can be collapsed:
src/sr/../database/finder.rs#L516
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 + }
|
|
this `else { if .. }` block can be collapsed:
src/sr/../database/finder.rs#L330
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 + }
|
|
unused import: `tracing::warn`:
src/sr/../database/mod.rs#L11
warning: unused import: `tracing::warn`
--> src/sr/../database/mod.rs:11:5
|
11 | use tracing::warn;
| ^^^^^^^^^^^^^
|
unused import: `crate::rc_refcell`:
src/sr/../database/mod.rs#L6
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
|
called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent:
build.rs#L118
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
|
rust-coverage
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v2, actions-rs/toolchain@v1, codecov/codecov-action@v3. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|
rust-coverage
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions-rs/toolchain@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
rust-coverage
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
rust-coverage
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
rust-coverage
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
rust-coverage
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|