Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand All @@ -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 }
Expand All @@ -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 }
14 changes: 4 additions & 10 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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!(),
}
Expand All @@ -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!(),
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/server/http_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ fn request<T: Read + Write>(
(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 {
Expand Down
2 changes: 1 addition & 1 deletion src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fn request(pstate: Arc<AuthenticatorState>, 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(());
Expand Down
2 changes: 1 addition & 1 deletion src/server/notifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/refresher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -372,7 +372,7 @@ impl Refresher {
{
expiry = cmp::min(expiry, t);
}
Some(expiry.to_owned())
Some(expiry)
}
_ => None,
}
Expand Down
12 changes: 6 additions & 6 deletions src/server/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ mod test {
conf,
Some(0),
Some(0),
Some("".to_string()),
Some(String::new()),
eventer,
notifier,
Refresher::new(),
Expand Down Expand Up @@ -747,7 +747,7 @@ mod test {
conf,
Some(0),
Some(0),
Some("".to_string()),
Some(String::new()),
eventer,
notifier,
Refresher::new(),
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -829,7 +829,7 @@ mod test {
conf,
Some(0),
Some(0),
Some("".to_string()),
Some(String::new()),
eventer,
notifier,
Refresher::new(),
Expand All @@ -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();
Expand Down Expand Up @@ -877,7 +877,7 @@ mod test {
conf,
Some(0),
Some(0),
Some("".to_string()),
Some(String::new()),
eventer,
notifier,
Refresher::new(),
Expand Down
Loading