diff --git a/Cargo.toml b/Cargo.toml index 6bdb8e2..8f13c0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,10 +72,17 @@ rust_2018_idioms = "deny" rust_2021_compatibility = "deny" rust_2024_compatibility = "deny" let_underscore = "warn" +# Especially heavyweight to resolve, for not much added readability +# This lint is also being revised, and current direction of travel +# (as of 2026-05-24) is to allow the fn(ContainsLifetime) -> NoLifetime cases +# present in the codebase, and to focus on the fn(&T) -> UnclearLifetime case +# instead. See also +# https://github.com/rust-lang/rust/issues/91639#issuecomment-2659700523 +# https://github.com/rust-lang/rust/pull/120808 +# https://rust-lang.zulipchat.com/#narrow/channel/213817/near/528092054 +elided_lifetimes_in_paths = { level = "allow", priority = 1 } ## TODO, disabled since they currently fail -### Would change style -elided_lifetimes_in_paths = { level = "allow", priority = 1 } ### Needs analysis + oversight for correctness tail_expr_drop_order = { level = "allow", priority = 1 } @@ -87,10 +94,7 @@ no_effect = { level = "allow", priority = 1 } pedantic = "warn" ## TODO, disabled since they currently fail ### Straightforward fix, for next PR -manual_string_new = { level = "allow", priority = 1 } items_after_statements = { level = "allow", priority = 1 } -ignored_unit_patterns = { level = "allow", priority = 1 } -implicit_clone = { level = "allow", priority = 1 } unused_self = { level = "allow", priority = 1 } ### Lint guidance seems wrong, needs decision similar_names = { level = "allow", priority = 1 } @@ -107,12 +111,18 @@ redundant_else = { level = "allow", priority = 1 } needless_pass_by_value = { level = "allow", priority = 1 } nursery = "warn" -## TODO, disabled since they currently fail -### Straightforward fix, for next PR -redundant_clone = { level = "allow", priority = 1 } +# Overzealous, false positives suggest broken code, see +# https://github.com/rust-lang/rust-clippy/issues/6066 and refs there needless_collect = { level = "allow", priority = 1 } + +## TODO, disabled since they currently fail ### Would change style, need buy-in + style guide option_if_let_else = { level = "allow", priority = 1 } ### Needs analysis + oversight for correctness missing_const_for_fn = { level = "allow", priority = 1 } significant_drop_tightening = { level = "allow", priority = 1 } + +## Blocked +### By: https://github.com/softdevteam/grmtools/pull/639 +implicit_clone = { level = "allow", priority = 1 } +redundant_clone = { level = "allow", priority = 1 } diff --git a/src/config.rs b/src/config.rs index 633ca61..b3fa8e8 100644 --- a/src/config.rs +++ b/src/config.rs @@ -572,10 +572,10 @@ impl Account { let mut url = Url::parse(&self.redirect_uri)?; if https_port.is_some() && self.redirect_uri.to_lowercase().starts_with("https") { url.set_port(https_port) - .map_err(|_| "Cannot set https port")?; + .map_err(|()| "Cannot set https port")?; } else { url.set_port(http_port) - .map_err(|_| "Cannot set http port")?; + .map_err(|()| "Cannot set http port")?; } Ok(url) } @@ -934,10 +934,7 @@ mod test { Err(e) if e.contains( "Account x has an 'http' redirect but the HTTP server is set to 'none'", - ) => - { - (); - } + ) => {} Err(e) => panic!("{e:?}"), _ => panic!(), } @@ -955,10 +952,7 @@ mod test { Err(e) if e.contains( "Account x has an 'https' redirect but the HTTPS server is set to 'none'", - ) => - { - (); - } + ) => {} Err(e) => panic!("{e:?}"), _ => panic!(), } diff --git a/src/main.rs b/src/main.rs index 33735e0..f182b9d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -310,7 +310,7 @@ fn main() { // Files in this directory MAY be subjected to periodic clean-up. To ensure that your files // are not removed, they should have their access time timestamp modified at least once every // 6 hours of monotonic time - let sock_path_cl = sock_path.clone(); + let sock_path_cl = sock_path; thread::spawn(move || loop { thread::sleep(Duration::from_hours(6)); let _ = utimensat( diff --git a/src/server/http_server.rs b/src/server/http_server.rs index f9a9c8b..9f2dd74 100644 --- a/src/server/http_server.rs +++ b/src/server/http_server.rs @@ -209,7 +209,7 @@ fn request( (Some("Bearer"), Some(expires_in), Some(access_token), refresh_token) => { let now = Instant::now(); let expiry = expiry_instant(&ct_lk, act_id, now, expires_in)?; - let act_name = ct_lk.account(act_id).name.to_owned(); + let act_name = ct_lk.account(act_id).name.clone(); ct_lk.tokenstate_replace( act_id, TokenState::Active { diff --git a/src/server/mod.rs b/src/server/mod.rs index 7272f8a..1a6d6b9 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -170,7 +170,7 @@ fn request(pstate: Arc, mut stream: UnixStream) -> Result<() } "restore" => { match pstate.restore(rest.to_vec()) { - Ok(_) => stream.write_all(b"ok:")?, + Ok(()) => stream.write_all(b"ok:")?, Err(e) => stream.write_all(format!("error:{e:}").as_bytes())?, } return Ok(()); diff --git a/src/server/notifier.rs b/src/server/notifier.rs index da49537..627160e 100644 --- a/src/server/notifier.rs +++ b/src/server/notifier.rs @@ -84,7 +84,7 @@ impl Notifier { let url = url.clone(); let act = ct_lk.account(act_id); if let Some(ref cmd) = ct_lk.config().auth_notify_cmd { - auth_cmds.push((act.name.to_owned(), cmd.clone(), url)); + auth_cmds.push((act.name.clone(), cmd.clone(), url)); } ct_lk.tokenstate_replace(act_id, ts); } diff --git a/src/server/refresher.rs b/src/server/refresher.rs index d4dab5d..f690839 100644 --- a/src/server/refresher.rs +++ b/src/server/refresher.rs @@ -357,7 +357,7 @@ impl Refresher { // If the second case occurs, we assume that the user knows that the token // really needs refreshing, and we treat the token as if it had expired. if let Some(t) = lra.checked_add(act.refresh_retry(ct_lk.config())) { - return Some(t.to_owned()); + return Some(t); } } @@ -372,7 +372,7 @@ impl Refresher { { expiry = cmp::min(expiry, t); } - Some(expiry.to_owned()) + Some(expiry) } _ => None, } diff --git a/src/server/state.rs b/src/server/state.rs index d039037..408adcb 100644 --- a/src/server/state.rs +++ b/src/server/state.rs @@ -613,7 +613,7 @@ mod test { conf, Some(0), Some(0), - Some("".to_string()), + Some(String::new()), eventer, notifier, Refresher::new(), @@ -747,7 +747,7 @@ mod test { conf, Some(0), Some(0), - Some("".to_string()), + Some(String::new()), eventer, notifier, Refresher::new(), @@ -784,7 +784,7 @@ mod test { } { - pstate.restore(dump.clone()).unwrap(); + pstate.restore(dump).unwrap(); let ct_lk = pstate.ct_lock(); let x_id = ct_lk.validate_act_name("x").unwrap(); @@ -829,7 +829,7 @@ mod test { conf, Some(0), Some(0), - Some("".to_string()), + Some(String::new()), eventer, notifier, Refresher::new(), @@ -843,7 +843,7 @@ mod test { } { - pstate.restore(dump.clone()).unwrap(); + pstate.restore(dump).unwrap(); let ct_lk = pstate.ct_lock(); let x_id = ct_lk.validate_act_name("x").unwrap(); @@ -877,7 +877,7 @@ mod test { conf, Some(0), Some(0), - Some("".to_string()), + Some(String::new()), eventer, notifier, Refresher::new(),