Merge branch 'reorganisation' of github.com:LeChatP/RootAsRole into r… #201
Annotations
37 warnings
field assignment outside of initializer for an instance created with Default::default():
src/chsr/cli/process/json.rs#L888
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/chsr/cli/process/json.rs:888:13
|
888 | path.default_behavior = options_path_policy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `rar_common::database::options::SPathOptions { default_behavior: options_path_policy, ..Default::default() }` and removing relevant reassignments
--> src/chsr/cli/process/json.rs:887:13
|
887 | let mut path = SPathOptions::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/cli/process/json.rs#L610
warning: field assignment outside of initializer for an instance created with Default::default()
--> src/chsr/cli/process/json.rs:610:9
|
610 | env.default_behavior = options_env_policy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `rar_common::database::options::SEnvOptions { default_behavior: options_env_policy, ..Default::default() }` and removing relevant reassignments
--> src/chsr/cli/process/json.rs:609:9
|
609 | 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
|
very complex type used. Consider factoring parts into `type` definitions:
src/chsr/cli/pair.rs#L22
warning: very complex type used. Consider factoring parts into `type` definitions
--> src/chsr/cli/pair.rs:22:18
|
22 | do_matching: &dyn Fn(&Pair<Rule>, &mut Inputs) -> 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/data.rs#L46
warning: all variants have the same postfix: `List`
--> src/chsr/cli/data.rs:46:1
|
46 | / pub enum SetListType {
47 | | WhiteList,
48 | | BlackList,
49 | | CheckList,
50 | | SetList,
51 | | }
| |_^
|
= 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
|
unnecessary `if let` since only the `Some` variant of the iterator element is used:
src/sr/main.rs#L405
warning: unnecessary `if let` since only the `Some` variant of the iterator element is used
--> src/sr/main.rs:405:13
|
405 | for group in res {
| ^ --- help: try: `res.flatten()`
| _____________|
| |
406 | | if let Some(group) = group {
407 | | groups.push(group.gid.as_raw());
408 | | }
409 | | }
| |_____________^
|
help: ...and remove the `if let` statement in the for loop
--> src/sr/main.rs:406:17
|
406 | / if let Some(group) = group {
407 | | groups.push(group.gid.as_raw());
408 | | }
| |_________________^
= 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
|
returning the result of a `let` binding from a block:
src/sr/main.rs#L329
warning: returning the result of a `let` binding from a block
--> src/sr/main.rs:329:5
|
323 | / let user = Cred {
324 | | user,
325 | | groups,
326 | | tty,
327 | | ppid,
328 | | };
| |______- unnecessary `let` binding
329 | user
| ^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
= note: `#[warn(clippy::let_and_return)]` on by default
help: return the expression directly
|
323 ~
324 ~ Cred {
325 + user,
326 + groups,
327 + tty,
328 + ppid,
329 + }
|
|
`to_string` applied to a type that implements `Display` in `eprintln!` args:
src/sr/main.rs#L284
warning: `to_string` applied to a type that implements `Display` in `eprintln!` args
--> src/sr/main.rs:284:68
|
284 | eprintln!("sr: {} : {}", execcfg.exec_path.display(), e.to_string());
| ^^^^^^^^^^^^ help: remove this
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
= note: `#[warn(clippy::to_string_in_format_args)]` on by default
|
current MSRV (Minimum Supported Rust Version) is `1.74.1` but this item is stable since `1.76.0`:
src/sr/main.rs#L219
warning: current MSRV (Minimum Supported Rust Version) is `1.74.1` but this item is stable since `1.76.0`
--> src/sr/main.rs:219:14
|
219 | .inspect_err(|e| {
| ______________^
220 | | error!("{}", e);
221 | | })
| |______________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
= note: `#[warn(clippy::incompatible_msrv)]` on by default
|
this loop could be written as a `for` loop:
src/sr/main.rs#L182
warning: this loop could be written as a `for` loop
--> src/sr/main.rs:182:5
|
182 | while let Some(arg) = iter.next() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for arg in iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator
= note: `#[warn(clippy::while_let_on_iterator)]` on by default
|
the borrowed expression implements the required traits:
src/sr/timeout.rs#L184
warning: the borrowed expression implements the required traits
--> src/sr/timeout.rs:184:15
|
184 | .join(&user.user.uid.as_raw().to_string())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `user.user.uid.as_raw().to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
|
the borrowed expression implements the required traits:
src/sr/timeout.rs#L181
warning: the borrowed expression implements the required traits
--> src/sr/timeout.rs:181:44
|
181 | let path = Path::new(TS_LOCATION).join(&user.user.uid.as_raw().to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `user.user.uid.as_raw().to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
|
the borrowed expression implements the required traits:
src/sr/timeout.rs#L164
warning: the borrowed expression implements the required traits
--> src/sr/timeout.rs:164:44
|
164 | let path = Path::new(TS_LOCATION).join(&user.user.uid.as_raw().to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `user.user.uid.as_raw().to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
|
name `PPID` contains a capitalized acronym:
src/sr/timeout.rs#L40
warning: name `PPID` contains a capitalized acronym
--> src/sr/timeout.rs:40:5
|
40 | 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#L39
warning: name `TTY` contains a capitalized acronym
--> src/sr/timeout.rs:39:5
|
39 | 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
= note: `#[warn(clippy::upper_case_acronyms)]` on by default
|
passing a unit value to a function:
rar-common/src/util.rs#L79
warning: passing a unit value to a function
--> rar-common/src/util.rs:79:5
|
79 | / Ok(match effective {
80 | | false => {
81 | | read_effective(false).and(dac_override_effective(false))?;
82 | | }
... |
85 | | }
86 | | })
| |______^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
= note: `#[warn(clippy::unit_arg)]` on by default
help: move the expression in front of the call and replace it with the unit literal `()`
|
79 ~ match effective {
80 + false => {
81 + read_effective(false).and(dac_override_effective(false))?;
82 + }
83 + true => {
84 + read_effective(true).or(dac_override_effective(true))?;
85 + }
86 + };
87 + Ok(())
|
|
field assignment outside of initializer for an instance created with Default::default():
rar-common/src/database/structs.rs#L409
warning: field assignment outside of initializer for an instance created with Default::default()
--> rar-common/src/database/structs.rs:409:9
|
409 | ret.name = name;
| ^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `database::structs::STask { name: name, _role: Some(role), ..Default::default() }` and removing relevant reassignments
--> rar-common/src/database/structs.rs:408:9
|
408 | 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():
rar-common/src/database/structs.rs#L392
warning: field assignment outside of initializer for an instance created with Default::default()
--> rar-common/src/database/structs.rs:392:9
|
392 | ret.name = name;
| ^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `database::structs::SRole { name: name, _config: Some(config), ..Default::default() }` and removing relevant reassignments
--> rar-common/src/database/structs.rs:391:9
|
391 | 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():
rar-common/src/database/structs.rs#L327
warning: field assignment outside of initializer for an instance created with Default::default()
--> rar-common/src/database/structs.rs:327:9
|
327 | c.add = capset;
| ^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `database::structs::SCapabilities { add: capset, ..Default::default() }` and removing relevant reassignments
--> rar-common/src/database/structs.rs:326:9
|
326 | let mut c = SCapabilities::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
|
enum `SGroups` has a public `len` method, but no `is_empty` method:
rar-common/src/database/structs.rs#L84
warning: enum `SGroups` has a public `len` method, but no `is_empty` method
--> rar-common/src/database/structs.rs:84:5
|
84 | pub fn len(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
= note: `#[warn(clippy::len_without_is_empty)]` on by default
|
very complex type used. Consider factoring parts into `type` definitions:
rar-common/src/database/options.rs#L861
warning: very complex type used. Consider factoring parts into `type` definitions
--> rar-common/src/database/options.rs:861:10
|
861 | ) -> (
| __________^
862 | | EnvBehavior,
863 | | HashMap<String, String>,
864 | | LinkedHashSet<EnvKey>,
865 | | LinkedHashSet<EnvKey>,
866 | | LinkedHashSet<EnvKey>,
867 | | ) {
| |_____^
|
= 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:
rar-common/src/database/options.rs#L727
warning: very complex type used. Consider factoring parts into `type` definitions
--> rar-common/src/database/options.rs:727:10
|
727 | ) -> (
| __________^
728 | | PathBehavior,
729 | | Rc<RefCell<LinkedHashSet<String>>>,
730 | | Rc<RefCell<LinkedHashSet<String>>>,
731 | | ) {
| |_____^
|
= 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:
rar-common/src/database/options.rs#L672
warning: very complex type used. Consider factoring parts into `type` definitions
--> rar-common/src/database/options.rs:672:10
|
672 | ) -> (
| __________^
673 | | PathBehavior,
674 | | Rc<RefCell<LinkedHashSet<String>>>,
675 | | Rc<RefCell<LinkedHashSet<String>>>,
676 | | ) {
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
|
field assignment outside of initializer for an instance created with Default::default():
rar-common/src/database/options.rs#L588
warning: field assignment outside of initializer for an instance created with Default::default()
--> rar-common/src/database/options.rs:588:9
|
588 | opt.level = Level::Global;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `database::options::Opt { level: Level::Global, root: Some(SPrivileged::User), bounding: Some(SBounding::Strict), ..Default::default() }` and removing relevant reassignments
--> rar-common/src/database/options.rs:587:9
|
587 | 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:
rar-common/src/database/options.rs#L480
warning: stripping a prefix manually
--> rar-common/src/database/options.rs:480:9
|
480 | &tzval[1..]
| ^^^^^^^^^^^
|
note: the prefix was tested here
--> rar-common/src/database/options.rs:479:17
|
479 | 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
|
479 ~ let tzval = if let Some(<stripped>) = tzval.strip_prefix(':') {
480 ~ <stripped>
|
|
field assignment outside of initializer for an instance created with Default::default():
rar-common/src/database/options.rs#L437
warning: field assignment outside of initializer for an instance created with Default::default()
--> rar-common/src/database/options.rs:437:9
|
437 | res.default_behavior = behavior;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `database::options::SEnvOptions { default_behavior: behavior, ..Default::default() }` and removing relevant reassignments
--> rar-common/src/database/options.rs:436:9
|
436 | 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():
rar-common/src/database/options.rs#L278
warning: field assignment outside of initializer for an instance created with Default::default()
--> rar-common/src/database/options.rs:278:9
|
278 | timeout.type_field = Some(TimestampType::PPID);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `database::options::STimeout { type_field: Some(TimestampType::PPID), duration: Some(Duration::minutes(5)), ..Default::default() }` and removing relevant reassignments
--> rar-common/src/database/options.rs:277:9
|
277 | let mut timeout = STimeout::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():
rar-common/src/database/options.rs#L226
warning: field assignment outside of initializer for an instance created with Default::default()
--> rar-common/src/database/options.rs:226:9
|
226 | opt.level = level;
| ^^^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `database::options::Opt { level: level, ..Default::default() }` and removing relevant reassignments
--> rar-common/src/database/options.rs:225:9
|
225 | 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
|
direct implementation of `ToString`:
rar-common/src/database/options.rs#L132
warning: direct implementation of `ToString`
--> rar-common/src/database/options.rs:132:1
|
132 | / impl ToString for EnvKey {
133 | | fn to_string(&self) -> String {
134 | | self.value.clone()
135 | | }
136 | | }
| |_^
|
= help: prefer implementing `Display` instead
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_trait_impl
= note: `#[warn(clippy::to_string_trait_impl)]` on by default
|
very complex type used. Consider factoring parts into `type` definitions:
rar-common/src/database/migration.rs#L12
warning: very complex type used. Consider factoring parts into `type` definitions
--> rar-common/src/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:
rar-common/src/database/migration.rs#L11
warning: very complex type used. Consider factoring parts into `type` definitions
--> rar-common/src/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
|
unneeded `return` statement:
rar-common/src/database/finder.rs#L363
warning: unneeded `return` statement
--> rar-common/src/database/finder.rs:363:9
|
363 | return Ok(CmdMin::Match);
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
363 - return Ok(CmdMin::Match);
363 + Ok(CmdMin::Match)
|
|
unneeded `return` statement:
rar-common/src/database/finder.rs#L359
warning: unneeded `return` statement
--> rar-common/src/database/finder.rs:359:9
|
359 | / return evaluate_regex_cmd(role_args, commandline).inspect_err(|e| {
360 | | debug!("{:?},No match for args {:?}", e, input_args);
361 | | });
| |__________^
|
= 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`
|
359 ~ evaluate_regex_cmd(role_args, commandline).inspect_err(|e| {
360 + debug!("{:?},No match for args {:?}", e, input_args);
361 ~ })
|
|
you should consider adding a `Default` implementation for `PluginManager`:
rar-common/src/api.rs#L97
warning: you should consider adding a `Default` implementation for `PluginManager`
--> rar-common/src/api.rs:97:5
|
97 | / pub fn new() -> Self {
98 | | PluginManager {
99 | | #[cfg(feature = "finder")]
100 | | role_matcher_plugins: Vec::new(),
... |
113 | | }
114 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
= note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
|
96 + impl Default for PluginManager {
97 + fn default() -> Self {
98 + Self::new()
99 + }
100 + }
|
|
constants have by default a `'static` lifetime:
rar-common/src/version.rs#L4
warning: constants have by default a `'static` lifetime
--> rar-common/src/version.rs:4:29
|
4 | pub const PACKAGE_VERSION: &'static str = "3.0.0-alpha.5";
| -^^^^^^^---- 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 seems like a manual implementation of the non-exhaustive pattern:
rar-common/src/database/structs.rs#L30
warning: this seems like a manual implementation of the non-exhaustive pattern
--> rar-common/src/database/structs.rs:30:1
|
30 | pub struct SConfig {
| ^-----------------
| |
| _help: add the attribute: `#[non_exhaustive] pub struct SConfig`
| |
31 | | #[serde(skip_serializing_if = "Option::is_none")]
32 | | pub options: OptWrapper,
33 | | #[serde(default, skip_serializing_if = "Vec::is_empty")]
... |
39 | | pub _extra_fields: Map<String, Value>,
40 | | }
| |_^
|
help: remove this field
--> rar-common/src/database/structs.rs:36:5
|
36 | 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
|
rust-coverage
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2. 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 following actions use a deprecated Node.js version and will be forced to run on node20: actions/checkout@v2, codecov/codecov-action@v3. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|