diff --git a/Cargo.toml b/Cargo.toml index 70b95855..0dcf8142 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,7 @@ default-members = [ "radicle-remote-helper", "radicle-term", ] +resolver = "2" [profile.container] inherits = "release" diff --git a/radicle-cli/src/commands/issue.rs b/radicle-cli/src/commands/issue.rs index baabf855..7d36e4f4 100644 --- a/radicle-cli/src/commands/issue.rs +++ b/radicle-cli/src/commands/issue.rs @@ -589,13 +589,13 @@ fn edit<'a, 'g, R: WriteRepository + cob::Store, G: radicle::crypto::Signer>( } // Editing via the editor. - let Some((title, description)) = - term::issue::get_title_description( - Some(title.unwrap_or(issue.title().to_owned())), - Some(description.unwrap_or(issue.description().to_owned())), - )? else { - return Ok(issue); - }; + let Some((title, description)) = term::issue::get_title_description( + Some(title.unwrap_or(issue.title().to_owned())), + Some(description.unwrap_or(issue.description().to_owned())), + )? + else { + return Ok(issue); + }; issue.transaction("Edit", signer, |tx| { tx.edit(title)?; diff --git a/radicle-cli/src/commands/label.rs b/radicle-cli/src/commands/label.rs index 143bec52..cc700c1d 100644 --- a/radicle-cli/src/commands/label.rs +++ b/radicle-cli/src/commands/label.rs @@ -86,7 +86,7 @@ fn label( let labels = issue .labels() .cloned() - .chain(options.labels.into_iter()) + .chain(options.labels) .collect::>(); issue.label(labels, &signer)?; @@ -103,7 +103,7 @@ fn label( let labels = patch .labels() .cloned() - .chain(options.labels.into_iter()) + .chain(options.labels) .collect::>(); patch.label(labels, &signer)?; diff --git a/radicle-cli/src/commands/unlabel.rs b/radicle-cli/src/commands/unlabel.rs index b7d28cbe..248b45d7 100644 --- a/radicle-cli/src/commands/unlabel.rs +++ b/radicle-cli/src/commands/unlabel.rs @@ -83,8 +83,8 @@ fn unlabel( Ok(mut issue) => { let labels = issue .labels() + .filter(|&l| !options.labels.contains(l)) .cloned() - .filter(|l| !options.labels.contains(l)) .collect::>(); issue.label(labels, &signer)?; @@ -99,8 +99,8 @@ fn unlabel( Ok(mut patch) => { let labels = patch .labels() + .filter(|&l| !options.labels.contains(l)) .cloned() - .filter(|l| !options.labels.contains(l)) .collect::>(); patch.label(labels, &signer)?; diff --git a/radicle-cli/src/git/unified_diff.rs b/radicle-cli/src/git/unified_diff.rs index 997f74a6..5eee19c7 100644 --- a/radicle-cli/src/git/unified_diff.rs +++ b/radicle-cli/src/git/unified_diff.rs @@ -439,10 +439,10 @@ impl Decode for Hunk { } let Some(line) = Modification::try_decode(r)? else { - return Err(Error::syntax(format!( - "expected '{}' old lines and '{}' new lines, but found '{}' and '{}'", - header.old_size, header.new_size, old_line, new_line, - ))); + return Err(Error::syntax(format!( + "expected '{}' old lines and '{}' new lines, but found '{}' and '{}'", + header.old_size, header.new_size, old_line, new_line, + ))); }; let line = match line { diff --git a/radicle-cli/src/terminal/args.rs b/radicle-cli/src/terminal/args.rs index 221d53e1..4b1b5391 100644 --- a/radicle-cli/src/terminal/args.rs +++ b/radicle-cli/src/terminal/args.rs @@ -123,7 +123,7 @@ pub fn rid(val: &OsString) -> anyhow::Result { pub fn pubkey(val: &OsString) -> anyhow::Result { let Ok(did) = did(val) else { let nid = nid(val)?; - return Ok(nid) + return Ok(nid); }; Ok(did.as_key().to_owned()) } diff --git a/radicle-cli/src/terminal/highlight.rs b/radicle-cli/src/terminal/highlight.rs index 2184a055..19198973 100644 --- a/radicle-cli/src/terminal/highlight.rs +++ b/radicle-cli/src/terminal/highlight.rs @@ -142,10 +142,8 @@ impl Builder { let name = HIGHLIGHTS[h.0]; self.advance(); - self.styles.push( - term::Style::default() - .fg(theme.highlight(name).unwrap_or(term::Color::default())), - ); + self.styles + .push(term::Style::default().fg(theme.highlight(name).unwrap_or_default())); } ts::HighlightEvent::HighlightEnd => { self.advance(); diff --git a/radicle-crypto/src/lib.rs b/radicle-crypto/src/lib.rs index 83e0fac1..0d1278d9 100644 --- a/radicle-crypto/src/lib.rs +++ b/radicle-crypto/src/lib.rs @@ -284,7 +284,7 @@ pub enum PublicKeyError { impl PartialOrd for PublicKey { fn partial_cmp(&self, other: &Self) -> Option { - self.0.as_ref().partial_cmp(other.as_ref()) + Some(self.cmp(other)) } } diff --git a/radicle-fetch/src/stage.rs b/radicle-fetch/src/stage.rs index 8dff7ac2..ebd29229 100644 --- a/radicle-fetch/src/stage.rs +++ b/radicle-fetch/src/stage.rs @@ -511,12 +511,13 @@ fn special_refs_updates<'a>( } refs::ReceivedRefname::RadId => None, }) - .fold(BTreeMap::new(), |mut acc, (remote_id, tip, name)| { - acc.entry(*remote_id) - .or_insert_with(Vec::new) - .push((tip, name)); - acc - }); + .fold( + BTreeMap::>::new(), + |mut acc, (remote_id, tip, name)| { + acc.entry(*remote_id).or_default().push((tip, name)); + acc + }, + ); let mut updates = Updates::default(); diff --git a/radicle-fetch/src/state.rs b/radicle-fetch/src/state.rs index ac261c0f..66778109 100644 --- a/radicle-fetch/src/state.rs +++ b/radicle-fetch/src/state.rs @@ -267,7 +267,7 @@ impl FetchState { } let up = step.prepare_updates(self, &handle.repo, &refs)?; - self.update_all(up.tips.into_iter()); + self.update_all(up.tips); Ok(fetched) } diff --git a/radicle-fetch/src/transport.rs b/radicle-fetch/src/transport.rs index 75cc7092..98c411b7 100644 --- a/radicle-fetch/src/transport.rs +++ b/radicle-fetch/src/transport.rs @@ -159,7 +159,7 @@ where { use gix_pack::index::File; - let idx = File::at(&pack_path, gix_hash::Kind::Sha1).map_err(io_other)?; + let idx = File::at(pack_path, gix_hash::Kind::Sha1).map_err(io_other)?; for oid in wants_haves.wants { if idx.lookup(oid::to_object_id(oid)).is_none() { return Err(io::Error::new( diff --git a/radicle-httpd/src/api/json.rs b/radicle-httpd/src/api/json.rs index 9e19b33a..63f956a9 100644 --- a/radicle-httpd/src/api/json.rs +++ b/radicle-httpd/src/api/json.rs @@ -137,7 +137,7 @@ pub(crate) fn patch( "description": rev.description(), "base": rev.base(), "oid": rev.head(), - "refs": get_refs(repo, patch.author().id(), &rev.head()).unwrap_or(vec![]), + "refs": get_refs(repo, patch.author().id(), &rev.head()).unwrap_or_default(), "discussions": rev.discussion().comments() .map(|(id, comment)| Comment::new(id, comment, aliases)) .collect::>(), diff --git a/radicle-httpd/src/api/v1/delegates.rs b/radicle-httpd/src/api/v1/delegates.rs index aa584adf..375af9c4 100644 --- a/radicle-httpd/src/api/v1/delegates.rs +++ b/radicle-httpd/src/api/v1/delegates.rs @@ -40,19 +40,35 @@ async fn delegates_projects_handler( .inventory()? .into_iter() .filter_map(|id| { - let Ok(repo) = storage.repository(id) else { return None }; - let Ok((_, head)) = repo.head() else { return None }; - let Ok(DocAt { doc, .. }) = repo.identity_doc() else { return None }; - let Ok(payload) = doc.project() else { return None }; + let Ok(repo) = storage.repository(id) else { + return None; + }; + let Ok((_, head)) = repo.head() else { + return None; + }; + let Ok(DocAt { doc, .. }) = repo.identity_doc() else { + return None; + }; + let Ok(payload) = doc.project() else { + return None; + }; if !doc.delegates.iter().any(|d| *d == delegate) { return None; } - let Ok(issues) = Issues::open(&repo) else { return None }; - let Ok(issues) = issues.counts() else { return None }; - let Ok(patches) = Patches::open(&repo) else { return None }; - let Ok(patches) = patches.counts() else { return None }; + let Ok(issues) = Issues::open(&repo) else { + return None; + }; + let Ok(issues) = issues.counts() else { + return None; + }; + let Ok(patches) = Patches::open(&repo) else { + return None; + }; + let Ok(patches) = patches.counts() else { + return None; + }; let delegates = doc.delegates; let trackings = routing.count(&id).unwrap_or_default(); diff --git a/radicle-httpd/src/api/v1/projects.rs b/radicle-httpd/src/api/v1/projects.rs index 5e4af540..a7fe11e7 100644 --- a/radicle-httpd/src/api/v1/projects.rs +++ b/radicle-httpd/src/api/v1/projects.rs @@ -87,15 +87,31 @@ async fn project_root_handler( .inventory()? .into_iter() .filter_map(|id| { - let Ok(repo) = storage.repository(id) else { return None }; - let Ok((_, head)) = repo.head() else { return None }; - let Ok(DocAt { doc, .. }) = repo.identity_doc() else { return None }; + let Ok(repo) = storage.repository(id) else { + return None; + }; + let Ok((_, head)) = repo.head() else { + return None; + }; + let Ok(DocAt { doc, .. }) = repo.identity_doc() else { + return None; + }; - let Ok(payload) = doc.project() else { return None }; - let Ok(issues) = issue::Issues::open(&repo) else { return None }; - let Ok(issues) = issues.counts() else { return None }; - let Ok(patches) = patch::Patches::open(&repo) else { return None }; - let Ok(patches) = patches.counts() else { return None }; + let Ok(payload) = doc.project() else { + return None; + }; + let Ok(issues) = issue::Issues::open(&repo) else { + return None; + }; + let Ok(issues) = issues.counts() else { + return None; + }; + let Ok(patches) = patch::Patches::open(&repo) else { + return None; + }; + let Ok(patches) = patches.counts() else { + return None; + }; let delegates = doc.delegates; let trackings = routing.count(&id).unwrap_or_default(); diff --git a/radicle-httpd/src/test.rs b/radicle-httpd/src/test.rs index 75645a1e..0c4c5499 100644 --- a/radicle-httpd/src/test.rs +++ b/radicle-httpd/src/test.rs @@ -95,7 +95,7 @@ pub fn contributor(dir: &Path) -> Context { } fn seed_with_signer(dir: &Path, profile: radicle::Profile, signer: &G) -> Context { - const DEFAULT_BRANCH: &'static str = "master"; + const DEFAULT_BRANCH: &str = "master"; let tracking_db = dir.join("radicle").join("node").join("tracking.db"); let routing_db = dir.join("radicle").join("node").join("routing.db"); diff --git a/radicle-node/src/runtime.rs b/radicle-node/src/runtime.rs index 9b3f853e..a96861c7 100644 --- a/radicle-node/src/runtime.rs +++ b/radicle-node/src/runtime.rs @@ -159,7 +159,7 @@ impl Runtime { log::info!(target: "node", "Default tracking policy set to '{}'", &policy); log::info!(target: "node", "Initializing service ({:?})..", network); - let announcement = if let Some(ann) = fs::read(&node_dir.join(NODE_ANNOUNCEMENT_FILE)) + let announcement = if let Some(ann) = fs::read(node_dir.join(NODE_ANNOUNCEMENT_FILE)) .ok() .and_then(|ann| NodeAnnouncement::decode(&mut ann.as_slice()).ok()) .and_then(|ann| { diff --git a/radicle-node/src/service.rs b/radicle-node/src/service.rs index bff6c57a..f8ba8051 100644 --- a/radicle-node/src/service.rs +++ b/radicle-node/src/service.rs @@ -1777,7 +1777,7 @@ where .filter(|(nid, _)| !self.sessions.contains_key(nid)) .filter(|(nid, _)| nid != &self.node_id()) .fold(HashMap::new(), |mut acc, (nid, addr)| { - acc.entry(nid).or_insert_with(Vec::new).push(addr); + acc.entry(nid).or_default().push(addr); acc }) } diff --git a/radicle-node/src/service/message.rs b/radicle-node/src/service/message.rs index 3d6c51bb..c7b91e92 100644 --- a/radicle-node/src/service/message.rs +++ b/radicle-node/src/service/message.rs @@ -369,7 +369,7 @@ impl Announcement { #[cfg(not(debug_assertions))] pub const POW_PARAMS: (u8, u32, u32) = (15, 8, 1); /// Salt used for generating PoW. - pub const POW_SALT: &[u8] = &[b'r', b'a', b'd']; + pub const POW_SALT: &'static [u8] = &[b'r', b'a', b'd']; /// Verify this announcement's signature. pub fn verify(&self) -> bool { diff --git a/radicle-node/src/wire/protocol.rs b/radicle-node/src/wire/protocol.rs index 7e45ab00..19757b2e 100644 --- a/radicle-node/src/wire/protocol.rs +++ b/radicle-node/src/wire/protocol.rs @@ -393,7 +393,10 @@ where return; }; - let Peer::Connected { nid, link, streams, .. } = peer else { + let Peer::Connected { + nid, link, streams, .. + } = peer + else { log::warn!(target: "wire", "Peer {nid} is not connected; ignoring fetch result"); return; }; @@ -834,15 +837,16 @@ where } => { log::trace!(target: "wire", "Processing fetch for {rid} from {remote}.."); - let Some((fd, Peer::Connected { link, streams, .. })) = - self.peers.lookup_mut(&remote) else { - // Nb. It's possible that a peer is disconnected while an `Io::Fetch` - // is in the service's i/o buffer. Since the service may not purge the - // buffer on disconnect, we should just ignore i/o actions that don't - // have a connected peer. - log::error!(target: "wire", "Peer {remote} is not connected: dropping fetch"); - continue; - }; + let Some((fd, Peer::Connected { link, streams, .. })) = + self.peers.lookup_mut(&remote) + else { + // Nb. It's possible that a peer is disconnected while an `Io::Fetch` + // is in the service's i/o buffer. Since the service may not purge the + // buffer on disconnect, we should just ignore i/o actions that don't + // have a connected peer. + log::error!(target: "wire", "Peer {remote} is not connected: dropping fetch"); + continue; + }; let (stream, channels) = streams.open(); log::debug!(target: "wire", "Opened new stream with id {stream} for {rid} and remote {remote}"); diff --git a/radicle-term/src/editor.rs b/radicle-term/src/editor.rs index f61b3512..0586f2ce 100644 --- a/radicle-term/src/editor.rs +++ b/radicle-term/src/editor.rs @@ -63,12 +63,10 @@ impl Editor { } let Some(cmd) = self::default_editor() else { - return Err( - io::Error::new( - io::ErrorKind::NotFound, - "editor not configured: the `EDITOR` environment variable is not set" - ) - ); + return Err(io::Error::new( + io::ErrorKind::NotFound, + "editor not configured: the `EDITOR` environment variable is not set", + )); }; // We duplicate the stderr file descriptor to pass it to the child process, otherwise, if diff --git a/radicle-term/src/io.rs b/radicle-term/src/io.rs index 24844839..fae53a6e 100644 --- a/radicle-term/src/io.rs +++ b/radicle-term/src/io.rs @@ -1,4 +1,5 @@ use std::ffi::OsStr; +use std::fmt::Write; use std::{env, fmt, io, process}; use inquire::ui::{ErrorMessageRenderConfig, StyleSheet, Styled}; @@ -127,9 +128,10 @@ pub fn print(msg: impl fmt::Display) { } pub fn prefixed(prefix: &str, text: &str) -> String { - text.split('\n') - .map(|line| format!("{prefix}{line}\n")) - .collect() + text.split('\n').fold(String::new(), |mut s, line| { + writeln!(&mut s, "{prefix}{line}").ok(); + s + }) } pub fn help(name: &str, version: &str, description: &str, usage: &str) { diff --git a/radicle/src/cob/identity.rs b/radicle/src/cob/identity.rs index 99d3c715..6ca086c5 100644 --- a/radicle/src/cob/identity.rs +++ b/radicle/src/cob/identity.rs @@ -293,10 +293,17 @@ impl store::Cob for Identity { fn from_root(op: Op, repo: &R) -> Result { let mut actions = op.actions.into_iter(); - let Some( - Action::Revision { title, description, blob, signature, parent } - ) = actions.next() else { - return Err(ApplyError::Init("the first action must be of type `revision`")); + let Some(Action::Revision { + title, + description, + blob, + signature, + parent, + }) = actions.next() + else { + return Err(ApplyError::Init( + "the first action must be of type `revision`", + )); }; if parent.is_some() { return Err(ApplyError::Init( diff --git a/radicle/src/cob/issue.rs b/radicle/src/cob/issue.rs index db980ffd..487144b5 100644 --- a/radicle/src/cob/issue.rs +++ b/radicle/src/cob/issue.rs @@ -131,7 +131,12 @@ impl store::Cob for Issue { fn from_root(op: Op, repo: &R) -> Result { let doc = op.identity_doc(repo)?.ok_or(Error::MissingIdentity)?; let mut actions = op.actions.into_iter(); - let Some(Action::Comment { body, reply_to: None, embeds }) = actions.next() else { + let Some(Action::Comment { + body, + reply_to: None, + embeds, + }) = actions.next() + else { return Err(Error::Init("the first action must be of type `comment`")); }; let comment = Comment::new(op.author, body, None, None, embeds, op.timestamp); diff --git a/radicle/src/cob/op.rs b/radicle/src/cob/op.rs index 2d7e2873..f93e3549 100644 --- a/radicle/src/cob/op.rs +++ b/radicle/src/cob/op.rs @@ -46,7 +46,7 @@ pub struct Op { impl PartialOrd for Op { fn partial_cmp(&self, other: &Self) -> Option { - self.id.partial_cmp(&other.id) + Some(self.cmp(other)) } } diff --git a/radicle/src/cob/patch.rs b/radicle/src/cob/patch.rs index f6538185..1bb851e4 100644 --- a/radicle/src/cob/patch.rs +++ b/radicle/src/cob/patch.rs @@ -1073,7 +1073,13 @@ impl store::Cob for Patch { fn from_root(op: Op, repo: &R) -> Result { let doc = op.identity_doc(repo)?.ok_or(Error::MissingIdentity)?; let mut actions = op.actions.into_iter(); - let Some(Action::Revision { description, base, oid, resolves }) = actions.next() else { + let Some(Action::Revision { + description, + base, + oid, + resolves, + }) = actions.next() + else { return Err(Error::Init("the first action must be of type `revision`")); }; let Some(Action::Edit { title, target }) = actions.next() else { diff --git a/radicle/src/cob/thread.rs b/radicle/src/cob/thread.rs index d91a2a3b..4a72d556 100644 --- a/radicle/src/cob/thread.rs +++ b/radicle/src/cob/thread.rs @@ -383,7 +383,11 @@ impl cob::store::Cob for Thread { let timestamp = op.timestamp; let identity = op.identity.ok_or(Error::MissingIdentity)?; let mut actions = op.actions.into_iter(); - let Some(Action::Comment { body, reply_to: None }) = actions.next() else { + let Some(Action::Comment { + body, + reply_to: None, + }) = actions.next() + else { return Err(Error::Init("missing initial comment")); }; diff --git a/radicle/src/node/address/store.rs b/radicle/src/node/address/store.rs index 776d9682..bf104dcf 100644 --- a/radicle/src/node/address/store.rs +++ b/radicle/src/node/address/store.rs @@ -46,8 +46,8 @@ impl From for Book { } impl Book { - const SCHEMA: &str = include_str!("schema.sql"); - const PRAGMA: &str = "PRAGMA foreign_keys = ON"; + const SCHEMA: &'static str = include_str!("schema.sql"); + const PRAGMA: &'static str = "PRAGMA foreign_keys = ON"; /// Open an address book at the given path. Creates a new address book if it /// doesn't exist. diff --git a/radicle/src/node/routing.rs b/radicle/src/node/routing.rs index d38a4e51..a47dc898 100644 --- a/radicle/src/node/routing.rs +++ b/radicle/src/node/routing.rs @@ -50,7 +50,7 @@ impl fmt::Debug for Table { } impl Table { - const SCHEMA: &str = include_str!("routing/schema.sql"); + const SCHEMA: &'static str = include_str!("routing/schema.sql"); /// Open a routing file store at the given path. Creates a new empty store /// if an existing store isn't found. diff --git a/radicle/src/node/tracking/store.rs b/radicle/src/node/tracking/store.rs index 31ff6d4b..89f5a24a 100644 --- a/radicle/src/node/tracking/store.rs +++ b/radicle/src/node/tracking/store.rs @@ -49,7 +49,7 @@ impl fmt::Debug for Config { } impl Config { - const SCHEMA: &str = include_str!("schema.sql"); + const SCHEMA: &'static str = include_str!("schema.sql"); /// Same as [`Self::open`], but in read-only mode. This is useful to have multiple /// open databases, as no locking is required. @@ -81,7 +81,7 @@ impl Config { } impl Config { - const SCHEMA: &str = include_str!("schema.sql"); + const SCHEMA: &'static str = include_str!("schema.sql"); /// Open a policy store at the given path. Creates a new store if it /// doesn't exist. diff --git a/radicle/src/storage.rs b/radicle/src/storage.rs index c2206c73..da48793b 100644 --- a/radicle/src/storage.rs +++ b/radicle/src/storage.rs @@ -116,7 +116,7 @@ impl Error { pub fn is_not_found(&self) -> bool { match self { Self::Io(e) if e.kind() == io::ErrorKind::NotFound => true, - Self::Git(e) if git::is_not_found_err(e) => true, + Self::Git(e) if git::ext::is_not_found_err(e) => true, Self::Doc(e) if e.is_not_found() => true, _ => false, } diff --git a/radicle/src/storage/git.rs b/radicle/src/storage/git.rs index 20b4d829..e12aefd6 100644 --- a/radicle/src/storage/git.rs +++ b/radicle/src/storage/git.rs @@ -23,7 +23,9 @@ use crate::storage::{ WriteRepository, WriteStorage, }; -pub use crate::git::*; +pub use crate::git::{ + ext, raw, refname, refspec, Oid, PatternStr, Qualified, RefError, RefString, UserInfo, +}; pub use crate::storage::Error; use super::{RemoteId, RemoteRepository, ValidateRepository}; @@ -605,8 +607,8 @@ impl ReadRepository for Repository { fn references_glob( &self, - pattern: &self::PatternStr, - ) -> Result, self::ext::Error> { + pattern: &PatternStr, + ) -> Result, git::ext::Error> { let mut refs = Vec::new(); for r in self.backend.references_glob(pattern)? { @@ -715,11 +717,11 @@ impl ReadRepository for Repository { Err(DocError::Missing.into()) } - fn merge_base(&self, left: &Oid, right: &Oid) -> Result { + fn merge_base(&self, left: &Oid, right: &Oid) -> Result { self.backend .merge_base(**left, **right) .map(Oid::from) - .map_err(ext::Error::from) + .map_err(git::ext::Error::from) } } @@ -941,7 +943,7 @@ mod tests { let m1 = fixtures::commit("M1", &[*c2, *b2], &repo); let m2 = fixtures::commit("M2", &[*a1, *b2], &repo); let mut rng = fastrand::Rng::new(); - let choices = vec![*c0, *c1, *c2, *b2, *a1, *a2, *d1, *m1, *m2]; + let choices = [*c0, *c1, *c2, *b2, *a1, *a2, *d1, *m1, *m2]; for _ in 0..100 { let count = rng.usize(1..=choices.len()); diff --git a/radicle/src/storage/git/transport/local/url.rs b/radicle/src/storage/git/transport/local/url.rs index 83b43270..5aa58278 100644 --- a/radicle/src/storage/git/transport/local/url.rs +++ b/radicle/src/storage/git/transport/local/url.rs @@ -45,7 +45,7 @@ pub struct Url { impl Url { /// URL scheme. - pub const SCHEME: &str = "rad"; + pub const SCHEME: &'static str = "rad"; /// Return this URL with the given namespace added. pub fn with_namespace(mut self, namespace: Namespace) -> Self { diff --git a/radicle/src/storage/git/transport/remote/url.rs b/radicle/src/storage/git/transport/remote/url.rs index a7085ac1..cf508d09 100644 --- a/radicle/src/storage/git/transport/remote/url.rs +++ b/radicle/src/storage/git/transport/remote/url.rs @@ -47,7 +47,7 @@ pub struct Url { impl Url { /// URL scheme. - pub const SCHEME: &str = "heartwood"; + pub const SCHEME: &'static str = "heartwood"; } impl fmt::Display for Url { diff --git a/radicle/src/test/storage.rs b/radicle/src/test/storage.rs index 9f1f32ce..a4625655 100644 --- a/radicle/src/test/storage.rs +++ b/radicle/src/test/storage.rs @@ -40,10 +40,7 @@ impl MockStorage { /// Add a remote `node` with `signed_refs` for the repo `rid`. pub fn insert_remote(&mut self, rid: Id, node: NodeId, refs: refs::SignedRefsAt) { - self.remotes - .entry(rid) - .or_insert(HashMap::new()) - .insert(node, refs); + self.remotes.entry(rid).or_default().insert(node, refs); } } diff --git a/rust-toolchain b/rust-toolchain index 12816e62..bc8a6589 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.71 +1.74