Revert mistake #79
Revert mistake #79
clippy
98 warnings
Details
Results
| Message level | Amount |
|---|---|
| Internal compiler error | 0 |
| Error | 0 |
| Warning | 98 |
| Note | 0 |
| Help | 0 |
Versions
- rustc 1.89.0 (29483883e 2025-08-04)
- cargo 1.89.0 (c24e10642 2025-06-23)
- clippy 0.1.89 (29483883ee 2025-08-04)
Annotations
Check warning on line 49 in src/sr/pam/mod.rs
github-actions / clippy
hiding a lifetime that's elided elsewhere is confusing
warning: hiding a lifetime that's elided elsewhere is confusing
--> src/sr/pam/mod.rs:49:13
|
49 | fn open(&self) -> std::io::Result<Terminal> {
| ^^^^^ -------- the same lifetime is hidden here
| |
| the lifetime is elided here
|
= help: the same lifetime is referred to in inconsistent ways, making the signature confusing
= note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: use `'_` for type paths
|
49 | fn open(&self) -> std::io::Result<Terminal<'_>> {
| ++++
Check warning on line 317 in src/sr/main.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/sr/main.rs:309:5
|
309 | / return Cred::builder()
310 | | .maybe_tty(stat::fstat(stdout().as_raw_fd()).ok().and_then(|s| {
311 | | if isatty(stdout().as_raw_fd()).ok().unwrap_or(false) {
312 | | Some(s.st_rdev)
... |
316 | | }))
317 | | .build();
| |________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
309 ~ Cred::builder()
310 + .maybe_tty(stat::fstat(stdout().as_raw_fd()).ok().and_then(|s| {
311 + if isatty(stdout().as_raw_fd()).ok().unwrap_or(false) {
312 + Some(s.st_rdev)
313 + } else {
314 + None
315 + }
316 + }))
317 ~ .build()
|
Check warning on line 154 in src/sr/main.rs
github-actions / clippy
useless conversion to the same type: `std::option::Option<rootasrole_core::database::actor::SGroups>`
warning: useless conversion to the same type: `std::option::Option<rootasrole_core::database::actor::SGroups>`
--> src/sr/main.rs:144:25
|
144 | group = iter
| _________________________^
145 | | .next()
146 | | .map(|s| {
147 | | SGroups::Multiple(
... |
153 | | })
154 | | .into();
| |___________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
help: consider removing `.into()`
|
144 ~ group = iter
145 + .next()
146 + .map(|s| {
147 + SGroups::Multiple(
148 + s.as_ref()
149 + .split(',')
150 + .map(|g| g.into())
151 + .collect::<Vec<SGroupType>>(),
152 + )
153 ~ });
|
Check warning on line 141 in src/sr/pam/mod.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/pam/mod.rs:141:40
|
141 | timeout::update_cookie(user, user, &timeout)?;
| ^^^^^^^^ help: change this to: `timeout`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 132 in src/sr/pam/mod.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/pam/mod.rs:132:50
|
132 | let is_valid = timeout::is_valid(user, user, &timeout);
| ^^^^^^^^ help: change this to: `timeout`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 82 in src/sr/pam/rpassword.rs
github-actions / clippy
calling .bytes() is very inefficient when data is not in memory
warning: calling .bytes() is very inefficient when data is not in memory
--> src/sr/pam/rpassword.rs:82:17
|
82 | let input = source.bytes().take_while(|x| x.as_ref().ok() != Some(&EOL));
| ^^^^^^^^^^^^^^
|
= help: consider using `BufReader`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unbuffered_bytes
= note: `#[warn(clippy::unbuffered_bytes)]` on by default
Check warning on line 237 in src/sr/finder/mod.rs
github-actions / clippy
using `clone` on type `Option<CapSet>` which implements the `Copy` trait
warning: using `clone` on type `Option<CapSet>` which implements the `Copy` trait
--> src/sr/finder/mod.rs:237:25
|
237 | self.caps = data.caps.clone();
| ^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `data.caps`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
= note: `#[warn(clippy::clone_on_copy)]` on by default
Check warning on line 236 in src/sr/finder/mod.rs
github-actions / clippy
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> src/sr/finder/mod.rs:233:30
|
233 | self.setgroups = data.setgroups.clone().and_then(|g| match g {
| ______________________________^
234 | | DGroups::Single(g) => Some(vec![g.fetch_id()].into_iter().flatten().collect()),
235 | | DGroups::Multiple(g) => Some(g.iter().filter_map(|g| g.fetch_id()).collect()),
236 | | });
| |______________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
help: use `map` instead
|
233 ~ self.setgroups = data.setgroups.clone().map(|g| match g {
234 ~ DGroups::Single(g) => vec![g.fetch_id()].into_iter().flatten().collect(),
235 ~ DGroups::Multiple(g) => g.iter().filter_map(|g| g.fetch_id()).collect(),
|
Check warning on line 232 in src/sr/finder/mod.rs
github-actions / clippy
called `map(..).flatten()` on `Option`
warning: called `map(..).flatten()` on `Option`
--> src/sr/finder/mod.rs:232:47
|
232 | self.setuid = data.setuid.clone().map(|u| u.fetch_id()).flatten();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|u| u.fetch_id())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
Check warning on line 220 in src/sr/finder/mod.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/finder/mod.rs:220:19
|
220 | &cli, &data, opt_stack, self, &mut score,
| ^^^^^ help: change this to: `data`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 220 in src/sr/finder/mod.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/finder/mod.rs:220:13
|
220 | &cli, &data, opt_stack, self, &mut score,
| ^^^^ help: change this to: `cli`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 103 in src/sr/finder/mod.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/finder/mod.rs:103:17
|
103 | &env_path,
| ^^^^^^^^^ help: change this to: `env_path`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 84 in src/sr/finder/mod.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/finder/mod.rs:84:17
|
84 | &env_path,
| ^^^^^^^^^ help: change this to: `env_path`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 971 in src/sr/finder/options.rs
github-actions / clippy
this pattern creates a reference to a reference
warning: this pattern creates a reference to a reference
--> src/sr/finder/options.rs:971:9
|
971 | ref is_safe => {
| ^^^^^^^^^^^ help: try: `is_safe`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 831 in src/sr/finder/options.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/finder/options.rs:831:25
|
831 | .opt_filter(&opt_filter)
| ^^^^^^^^^^^ help: change this to: `opt_filter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 793 in src/sr/finder/options.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/finder/options.rs:793:17
|
793 | &default_behavior,
| ^^^^^^^^^^^^^^^^^ help: change this to: `default_behavior`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 790 in src/sr/finder/options.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/sr/finder/options.rs:790:17
|
790 | &opt_filter,
| ^^^^^^^^^^^ help: change this to: `opt_filter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 746 in src/sr/finder/options.rs
github-actions / clippy
this lifetime isn't used in the function definition
warning: this lifetime isn't used in the function definition
--> src/sr/finder/options.rs:746:37
|
746 | fn determine_final_behavior<'a>(
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
Check warning on line 715 in src/sr/finder/options.rs
github-actions / clippy
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> src/sr/finder/options.rs:715:36
|
715 | .env_behavior(&o.env.as_ref().and_then(|e| Some(e.default_behavior)))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `o.env.as_ref().map(|e| e.default_behavior)`
|
= 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
Check warning on line 691 in src/sr/finder/options.rs
github-actions / clippy
this pattern creates a reference to a reference
warning: this pattern creates a reference to a reference
--> src/sr/finder/options.rs:691:25
|
691 | if let Some(ref path_opt) = opt {
| ^^^^^^^^^^^^ help: try: `path_opt`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 697 in src/sr/finder/options.rs
github-actions / clippy
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> src/sr/finder/options.rs:697:54
|
697 | &path_opt.sub.as_ref().map(|v| v.into_iter()),
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
Check warning on line 696 in src/sr/finder/options.rs
github-actions / clippy
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> src/sr/finder/options.rs:696:54
|
696 | &path_opt.add.as_ref().map(|v| v.into_iter()),
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
Check warning on line 700 in src/sr/finder/options.rs
github-actions / clippy
unnecessary `if let` since only the `Some` variant of the iterator element is used
warning: unnecessary `if let` since only the `Some` variant of the iterator element is used
--> src/sr/finder/options.rs:690:9
|
690 | / for opt in stack.iter() {
691 | | if let Some(ref path_opt) = opt {
692 | | calculate_combined_paths(
693 | | path_var,
... |
700 | | }
| |_________^
|
help: try `.flatten()` and remove the `if let` statement in the for loop
--> src/sr/finder/options.rs:691:13
|
691 | / if let Some(ref path_opt) = opt {
692 | | calculate_combined_paths(
693 | | path_var,
694 | | &mut combined_paths,
... |
698 | | );
699 | | }
| |_____________^
= 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
help: try
|
690 ~ for ref path_opt in stack.iter().flatten() {
691 + calculate_combined_paths(
692 + path_var,
693 + &mut combined_paths,
694 + &path_opt.default_behavior,
695 + &path_opt.add.as_ref().map(|v| v.into_iter()),
696 + &path_opt.sub.as_ref().map(|v| v.into_iter()),
697 + );
698 + }
|
Check warning on line 679 in src/sr/finder/options.rs
github-actions / clippy
called `map(..).flatten()` on `Option`
warning: called `map(..).flatten()` on `Option`
--> src/sr/finder/options.rs:679:32
|
679 | self.task.as_ref().map(|c| c.path.as_ref()).flatten(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|c| c.path.as_ref())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
Check warning on line 678 in src/sr/finder/options.rs
github-actions / clippy
called `map(..).flatten()` on `Option`
warning: called `map(..).flatten()` on `Option`
--> src/sr/finder/options.rs:678:32
|
678 | self.role.as_ref().map(|c| c.path.as_ref()).flatten(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|c| c.path.as_ref())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten