diff --git a/radicle-cli-test/src/lib.rs b/radicle-cli-test/src/lib.rs index 2af43454..16c8e9a2 100644 --- a/radicle-cli-test/src/lib.rs +++ b/radicle-cli-test/src/lib.rs @@ -211,7 +211,7 @@ impl TestFormula { let results = escargot::CargoBuild::new() .package(package) .bin(binary) - .manifest_path(&manifest.join("Cargo.toml")) + .manifest_path(manifest.join("Cargo.toml")) .target_dir(&target_dir) .exec() .unwrap(); diff --git a/radicle-cli/src/commands/patch/review/builder.rs b/radicle-cli/src/commands/patch/review/builder.rs index c589ddb2..be420a51 100644 --- a/radicle-cli/src/commands/patch/review/builder.rs +++ b/radicle-cli/src/commands/patch/review/builder.rs @@ -194,8 +194,8 @@ impl ReviewItem { fn paths(&self) -> (Option<(&Path, Oid)>, Option<(&Path, Oid)>) { match self { - Self::FileAdded { path, new, .. } => (None, Some((&path, new.oid))), - Self::FileDeleted { path, old, .. } => (Some((&path, old.oid)), None), + Self::FileAdded { path, new, .. } => (None, Some((path, new.oid))), + Self::FileDeleted { path, old, .. } => (Some((path, old.oid)), None), Self::FileMoved { moved } => ( Some((&moved.old_path, moved.old.oid)), Some((&moved.new_path, moved.new.oid)), @@ -797,7 +797,7 @@ impl<'a, G: Signer> ReviewBuilder<'a, G> { fn prompt( &self, mut input: impl io::BufRead, - mut output: &mut impl PromptWriter, + output: &mut impl PromptWriter, progress: impl fmt::Display, ) -> Option { if let Some(v) = self.verdict { @@ -808,7 +808,7 @@ impl<'a, G: Signer> ReviewBuilder<'a, G> { } else if output.is_terminal() { let prompt = term::format::secondary("Accept this hunk? [y,n,c,j,k,q,?]").bold(); - ReviewAction::prompt(&mut input, &mut output, format!("{progress} {prompt}")) + ReviewAction::prompt(&mut input, output, format!("{progress} {prompt}")) .unwrap_or(Some(ReviewAction::Help)) } else { Some(ReviewAction::Ignore) diff --git a/radicle-cli/src/git/ddiff.rs b/radicle-cli/src/git/ddiff.rs index 29761578..55b5a71c 100644 --- a/radicle-cli/src/git/ddiff.rs +++ b/radicle-cli/src/git/ddiff.rs @@ -371,7 +371,7 @@ impl unified_diff::Encode for FileDDiff { } /// A diff of a diff. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Default)] pub struct DDiff { files: Vec, } diff --git a/radicle-cli/src/terminal/highlight.rs b/radicle-cli/src/terminal/highlight.rs index fd923236..1c49506d 100644 --- a/radicle-cli/src/terminal/highlight.rs +++ b/radicle-cli/src/terminal/highlight.rs @@ -299,7 +299,6 @@ impl Highlighter { ) .expect("Highlighter::config: highlight configuration must be valid") })), - #[cfg(feature = "tree-sitter-ruby")] "ruby" => Some(self.configs.entry(language).or_insert_with(|| { ts::HighlightConfiguration::new( tree_sitter_ruby::language(), diff --git a/radicle-cli/tests/commands.rs b/radicle-cli/tests/commands.rs index 4e99253f..71026e10 100644 --- a/radicle-cli/tests/commands.rs +++ b/radicle-cli/tests/commands.rs @@ -856,7 +856,7 @@ fn rad_node() { test( "examples/rad-init-sync-not-connected.md", - &working.path().join("alice"), + working.path().join("alice"), Some(&alice.home), [], ) @@ -1632,7 +1632,7 @@ fn rad_init_sync_not_connected() { test( "examples/rad-init-sync-not-connected.md", - &working.path().join("alice"), + working.path().join("alice"), Some(&alice.home), [], ) @@ -1664,7 +1664,7 @@ fn rad_init_sync_preferred() { // Bob initializes a repo after her node has started, and after bob has connected to it. test( "examples/rad-init-sync-preferred.md", - &working.join("bob"), + working.join("bob"), Some(&bob.home), [], ) @@ -1696,7 +1696,7 @@ fn rad_init_sync_timeout() { // Bob initializes a repo after her node has started, and after bob has connected to it. test( "examples/rad-init-sync-timeout.md", - &working.join("bob"), + working.join("bob"), Some(&bob.home), [], ) @@ -1720,7 +1720,7 @@ fn rad_init_sync_and_clone() { // Alice initializes a repo after her node has started, and after bob has connected to it. test( "examples/rad-init-sync.md", - &working.join("alice"), + working.join("alice"), Some(&alice.home), [], ) @@ -1754,7 +1754,7 @@ fn rad_fetch() { // Alice initializes a repo after her node has started, and after bob has connected to it. test( "examples/rad-init-sync.md", - &working.join("alice"), + working.join("alice"), Some(&alice.home), [], ) @@ -1788,7 +1788,7 @@ fn rad_fork() { // Alice initializes a repo after her node has started, and after bob has connected to it. test( "examples/rad-init-sync.md", - &working.join("alice"), + working.join("alice"), Some(&alice.home), [], ) @@ -2865,28 +2865,28 @@ fn git_push_and_fetch() { test( "examples/rad-clone.md", - &working.join("bob"), + working.join("bob"), Some(&bob.home), [], ) .unwrap(); test( "examples/git/git-push.md", - &working.join("alice"), + working.join("alice"), Some(&alice.home), [], ) .unwrap(); test( "examples/git/git-fetch.md", - &working.join("bob"), + working.join("bob"), Some(&bob.home), [], ) .unwrap(); test( "examples/git/git-push-delete.md", - &working.join("alice"), + working.join("alice"), Some(&alice.home), [], ) @@ -2917,7 +2917,7 @@ fn git_tag() { test( "examples/rad-clone.md", - &working.join("bob"), + working.join("bob"), Some(&bob.home), [], ) @@ -2949,7 +2949,7 @@ fn rad_workflow() { test( "examples/workflow/1-new-project.md", - &working.join("alice"), + working.join("alice"), Some(&alice.home), [], ) @@ -2962,7 +2962,7 @@ fn rad_workflow() { test( "examples/workflow/2-cloning.md", - &working.join("bob"), + working.join("bob"), Some(&bob.home), [], ) @@ -2970,7 +2970,7 @@ fn rad_workflow() { test( "examples/workflow/3-issues.md", - &working.join("bob").join("heartwood"), + working.join("bob").join("heartwood"), Some(&bob.home), [], ) @@ -2978,7 +2978,7 @@ fn rad_workflow() { test( "examples/workflow/4-patching-contributor.md", - &working.join("bob").join("heartwood"), + working.join("bob").join("heartwood"), Some(&bob.home), [], ) @@ -2986,7 +2986,7 @@ fn rad_workflow() { test( "examples/workflow/5-patching-maintainer.md", - &working.join("alice"), + working.join("alice"), Some(&alice.home), [], ) @@ -2994,7 +2994,7 @@ fn rad_workflow() { test( "examples/workflow/6-pulling-contributor.md", - &working.join("bob").join("heartwood"), + working.join("bob").join("heartwood"), Some(&bob.home), [], ) diff --git a/radicle-cob/src/backend/git/change.rs b/radicle-cob/src/backend/git/change.rs index 172f0293..0ee02c7b 100644 --- a/radicle-cob/src/backend/git/change.rs +++ b/radicle-cob/src/backend/git/change.rs @@ -364,7 +364,7 @@ fn write_manifest( // Insert each COB entry. for (ix, op) in contents.iter().enumerate() { let oid = repo.blob(op.as_ref())?; - root.insert(&ix.to_string(), oid, git2::FileMode::Blob.into())?; + root.insert(ix.to_string(), oid, git2::FileMode::Blob.into())?; } // Insert each embed in a tree at `/embeds`. diff --git a/radicle-cob/src/lib.rs b/radicle-cob/src/lib.rs index 820336ef..198b0977 100644 --- a/radicle-cob/src/lib.rs +++ b/radicle-cob/src/lib.rs @@ -9,11 +9,10 @@ //! //! The basic types that are found in `radicle-cob` are: //! * [`CollaborativeObject`] -- the computed object itself. -//! * [`ObjectId`] -- the content-address for a single collaborative -//! object. +//! * [`ObjectId`] -- the content-address for a single collaborative object. //! * [`TypeName`] -- the name for a collection of collaborative objects. //! * [`History`] -- the traversable history of the changes made to -//! a single collaborative object. +//! a single collaborative object. //! //! ## CRU Interface (No Delete) //! @@ -32,7 +31,7 @@ //! storage capabilities: //! * [`object::Storage`] //! * [`change::Storage`] -- **Note**: there is already an -//! implementation for this for [`git2::Repository`] for convenience. +//! implementation for this for [`git2::Repository`] for convenience. //! //! ## Resource //! diff --git a/radicle-crdt/src/clock.rs b/radicle-crdt/src/clock.rs index 9aa2a6af..547f01d4 100644 --- a/radicle-crdt/src/clock.rs +++ b/radicle-crdt/src/clock.rs @@ -94,11 +94,11 @@ impl TryFrom<&str> for Lamport { impl Bounded for Lamport { fn min_value() -> Self { - Self::from(u64::min_value()) + Self::from(u64::MIN) } fn max_value() -> Self { - Self::from(u64::max_value()) + Self::from(u64::MAX) } } @@ -147,13 +147,13 @@ impl std::ops::Add for Physical { impl Bounded for Physical { fn min_value() -> Self { Self { - seconds: u64::min_value(), + seconds: u64::MIN, } } fn max_value() -> Self { Self { - seconds: u64::max_value(), + seconds: u64::MAX, } } } diff --git a/radicle-fetch/src/stage.rs b/radicle-fetch/src/stage.rs index a159e44e..d41fc12f 100644 --- a/radicle-fetch/src/stage.rs +++ b/radicle-fetch/src/stage.rs @@ -155,6 +155,7 @@ pub(crate) trait ProtocolStage { #[derive(Debug)] pub struct CanonicalId { pub remote: PublicKey, + #[allow(dead_code)] pub limit: u64, } @@ -231,6 +232,7 @@ pub struct SpecialRefs { /// The set of nodes that should be blocked from fetching. pub blocked: BlockList, /// The node that is being fetched from. + #[allow(dead_code)] pub remote: PublicKey, /// The set of nodes to be fetched. pub followed: policy::Allowed, @@ -240,6 +242,7 @@ pub struct SpecialRefs { /// The threshold of delegates that needs to be fetched. pub threshold: usize, /// The data limit for this stage of fetching. + #[allow(dead_code)] pub limit: u64, } @@ -311,6 +314,7 @@ pub struct SigrefsAt { /// The set of nodes that should be blocked from fetching. pub blocked: BlockList, /// The node that is being fetched from. + #[allow(dead_code)] pub remote: PublicKey, /// The set of remotes and the newly announced `Oid` for their /// `rad/sigrefs`. @@ -319,6 +323,7 @@ pub struct SigrefsAt { /// removed in the case of a `pull`. pub delegates: BTreeSet, /// The data limit for this stage of fetching. + #[allow(dead_code)] pub limit: u64, } @@ -400,11 +405,13 @@ impl ProtocolStage for SigrefsAt { #[derive(Debug)] pub struct DataRefs { /// The node that is being fetched from. + #[allow(dead_code)] pub remote: PublicKey, /// The set of signed references from each remote that was /// fetched. pub remotes: sigrefs::RemoteRefs, /// The data limit for this stage of fetching. + #[allow(dead_code)] pub limit: u64, } diff --git a/radicle-fetch/src/transport/ls_refs.rs b/radicle-fetch/src/transport/ls_refs.rs index 4abab011..3151c646 100644 --- a/radicle-fetch/src/transport/ls_refs.rs +++ b/radicle-fetch/src/transport/ls_refs.rs @@ -17,6 +17,7 @@ use super::{agent_name, indicate_end_of_interaction, Connection}; /// See [`run`]. pub struct Config { /// The repository name, i.e. `/`. + #[allow(dead_code)] pub repo: BString, /// Extra parameters to pass to the ls-refs process. pub extra_params: Vec<(String, Option)>, diff --git a/radicle-node/src/runtime.rs b/radicle-node/src/runtime.rs index 1b05606b..0210198b 100644 --- a/radicle-node/src/runtime.rs +++ b/radicle-node/src/runtime.rs @@ -113,7 +113,7 @@ impl Runtime { /// Initialize the runtime. /// /// This function spawns threads. - pub fn init( + pub fn init( home: Home, config: service::Config, listen: Vec, @@ -121,7 +121,7 @@ impl Runtime { signer: G, ) -> Result where - G: Ecdh + Clone, + G: Signer + Ecdh + Clone + 'static, { let id = *signer.public_key(); let alias = config.alias.clone(); diff --git a/radicle-node/src/service/message.rs b/radicle-node/src/service/message.rs index aff7c4d3..45201b3b 100644 --- a/radicle-node/src/service/message.rs +++ b/radicle-node/src/service/message.rs @@ -21,16 +21,6 @@ pub const REF_REMOTE_LIMIT: usize = 1024; /// Maximum number of inventory which can be announced to other nodes. pub const INVENTORY_LIMIT: usize = 2973; -#[derive(Debug, Clone, PartialEq, Eq)] -// TODO: We should check the length and charset when deserializing. -pub struct Hostname(String); - -impl fmt::Display for Hostname { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.0) - } -} - #[derive(Debug, Clone, PartialEq, Eq)] pub struct Subscribe { /// Subscribe to events matching this filter. diff --git a/radicle-node/src/test/simulator.rs b/radicle-node/src/test/simulator.rs index e0faa4e5..5ce87a0d 100644 --- a/radicle-node/src/test/simulator.rs +++ b/radicle-node/src/test/simulator.rs @@ -461,7 +461,7 @@ impl Simulation { } // If the other end has disconnected the sender with some latency, there may not be // a connection remaining to use. - if self.connections.get(&(node, receiver)).is_none() { + if !self.connections.contains(&(node, receiver)) { return; } let sender = node; diff --git a/radicle-node/src/worker/upload_pack.rs b/radicle-node/src/worker/upload_pack.rs index ad3e97b9..1914a31d 100644 --- a/radicle-node/src/worker/upload_pack.rs +++ b/radicle-node/src/worker/upload_pack.rs @@ -280,7 +280,9 @@ pub(super) mod pktline { #[derive(Debug)] pub struct GitRequest { pub repo: RepoId, + #[allow(dead_code)] pub path: String, + #[allow(dead_code)] pub host: Option<(String, Option)>, pub extra: Vec<(String, Option)>, } diff --git a/radicle/src/git.rs b/radicle/src/git.rs index ebe0c2d5..8677a1ae 100644 --- a/radicle/src/git.rs +++ b/radicle/src/git.rs @@ -717,9 +717,9 @@ pub mod url { } } - impl ToString for File { - fn to_string(&self) -> String { - format!("file://{}", self.path.display()) + impl std::fmt::Display for File { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "file://{}", self.path.display()) } } } diff --git a/radicle/src/identity/project.rs b/radicle/src/identity/project.rs index 97f1b4f1..3ff9412b 100644 --- a/radicle/src/identity/project.rs +++ b/radicle/src/identity/project.rs @@ -260,6 +260,7 @@ impl From for Payload { } #[cfg(test)] +#[allow(clippy::unwrap_used)] mod test { use super::*; use crate::assert_matches; diff --git a/rust-toolchain b/rust-toolchain index 3245dca3..d456f745 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.77 +1.80