diff --git a/benches/write_allowed_signers.rs b/benches/write_allowed_signers.rs index 0d12002..cf1f204 100644 --- a/benches/write_allowed_signers.rs +++ b/benches/write_allowed_signers.rs @@ -1,5 +1,5 @@ use chrono::{Local, TimeZone}; -use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Criterion}; +use codspeed_criterion_compat::{criterion_group, criterion_main, Criterion}; use hanko::{AllowedSigner, AllowedSignersFile}; pub fn criterion_benchmark(c: &mut Criterion) { diff --git a/src/allowed_signers.rs b/src/allowed_signers.rs index ebfa09c..2f703e8 100644 --- a/src/allowed_signers.rs +++ b/src/allowed_signers.rs @@ -1,7 +1,6 @@ //! Types and functions to interact with the OpenSSH `allowed_signers` file. //! -//! # File format -//! https://man.openbsd.org/ssh-keygen.1#ALLOWED_SIGNERS +//! [File Format Documentation](https://man.openbsd.org/ssh-keygen.1#ALLOWED_SIGNERS) use crate::SshPublicKey; use chrono::{DateTime, Local}; use std::{ @@ -81,7 +80,7 @@ impl AllowedSignersFile { pub fn write(&mut self) -> io::Result<()> { let mut file_buf = io::BufWriter::new(&mut self.file); for signer in &self.signers { - writeln!(file_buf, "{}", signer)?; + writeln!(file_buf, "{signer}")?; } writeln!(file_buf)?; Ok(()) @@ -158,7 +157,7 @@ mod tests { let path = tempfile::NamedTempFile::new().unwrap().into_temp_path(); let mut expected_content = String::new(); for signer in &example_signers { - expected_content.push_str(&format!("{}\n", signer)); + expected_content.push_str(&format!("{signer}\n")); } expected_content.push('\n'); @@ -175,7 +174,7 @@ mod tests { fn writing_overrides_existing_content(example_signers: Vec) { let existing_content = "gathered dust"; let mut existing_file = tempfile::NamedTempFile::new().unwrap(); - writeln!(existing_file, "{}", existing_content).unwrap(); + writeln!(existing_file, "{existing_content}").unwrap(); let path = existing_file.into_temp_path(); { diff --git a/src/cli/main.rs b/src/cli/main.rs index 0ba93c8..597cc5d 100644 --- a/src/cli/main.rs +++ b/src/cli/main.rs @@ -62,9 +62,9 @@ fn default_config_path() -> Resettable { let filename = "config.toml"; if let Ok(xdg_config_home) = env::var("XDG_CONFIG_HOME") { - Resettable::Value(format!("{}/{}/{}", xdg_config_home, dirname, filename).into()) + Resettable::Value(format!("{xdg_config_home}/{dirname}/{filename}").into()) } else if let Ok(home) = env::var("HOME") { - Resettable::Value(format!("{}/.config/{}/{}", home, dirname, filename).into()) + Resettable::Value(format!("{home}/.config/{dirname}/{filename}").into()) } else { Resettable::Reset } @@ -83,6 +83,6 @@ mod tests { #[test] fn verify_cli() { use clap::CommandFactory; - Cli::command().debug_assert() + Cli::command().debug_assert(); } } diff --git a/src/lib.rs b/src/lib.rs index 1bae3e1..7b9a5a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,7 @@ +#![warn(clippy::pedantic)] +#![warn(clippy::panic)] +#![forbid(unsafe_code)] + pub use allowed_signers::{AllowedSigner, AllowedSignersFile}; pub use config::Config; pub use core::*; diff --git a/src/provider/github.rs b/src/provider/github.rs index 5f95f86..3ae7dd1 100644 --- a/src/provider/github.rs +++ b/src/provider/github.rs @@ -17,8 +17,7 @@ impl Github { /// Get the signing keys of a user by their username. /// - /// # API documentation - /// https://docs.github.com/en/rest/users/ssh-signing-keys?apiVersion=2022-11-28#list-ssh-signing-keys-for-a-user + /// [API documentation](https://docs.github.com/en/rest/users/ssh-signing-keys?apiVersion=2022-11-28#list-ssh-signing-keys-for-a-user) pub async fn get_keys_by_username( &self, username: &str, diff --git a/src/provider/gitlab.rs b/src/provider/gitlab.rs index d2b4337..cf6519d 100644 --- a/src/provider/gitlab.rs +++ b/src/provider/gitlab.rs @@ -18,8 +18,7 @@ impl Gitlab { /// Get the signing keys of a user by their username. /// - /// # API documentation - /// https://docs.gitlab.com/16.10/ee/api/users.html#list-ssh-keys-for-user + /// [API Documentation](https://docs.gitlab.com/16.10/ee/api/users.html#list-ssh-keys-for-user) pub async fn get_keys_by_username( &self, username: &str,