From b0beef4391766d245370b852b0224d1b12efd198 Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Fri, 17 Oct 2025 11:33:53 +0200 Subject: [PATCH] workspace/rust/clippy: Fix all warnings Fix clippy warnings following the upgrade of the Rust toolchain to version 1.90. Almost all are "mismatched_lifetime_syntaxes". --- .../src/commands/patch/review/builder.rs | 2 +- crates/radicle-cli/src/git.rs | 4 ++-- crates/radicle-cli/src/project.rs | 2 +- crates/radicle-cli/src/terminal/patch/common.rs | 2 +- crates/radicle-crypto/src/lib.rs | 2 +- crates/radicle-fetch/src/git/repository/error.rs | 8 -------- crates/radicle-git-metadata/src/commit.rs | 2 +- .../radicle-git-metadata/src/commit/headers.rs | 2 +- crates/radicle-node/src/wire.rs | 2 +- crates/radicle-protocol/src/bounded.rs | 2 +- crates/radicle-protocol/src/service.rs | 2 +- crates/radicle-remote-helper/src/main.rs | 5 ++++- crates/radicle-ssh/src/encoding.rs | 6 +++--- crates/radicle/src/cob/identity.rs | 2 +- crates/radicle/src/cob/issue.rs | 2 +- crates/radicle/src/cob/patch.rs | 4 ++-- crates/radicle/src/git.rs | 12 ++++++------ crates/radicle/src/git/canonical/rules.rs | 2 +- crates/radicle/src/identity/doc.rs | 4 ++-- crates/radicle/src/storage.rs | 16 ++++++++-------- crates/radicle/src/storage/git.rs | 16 ++++++++-------- crates/radicle/src/storage/git/cob.rs | 16 ++++++++-------- crates/radicle/src/storage/refs.rs | 2 +- crates/radicle/src/test/fixtures.rs | 2 +- crates/radicle/src/test/storage.rs | 16 ++++++++-------- 25 files changed, 65 insertions(+), 70 deletions(-) diff --git a/crates/radicle-cli/src/commands/patch/review/builder.rs b/crates/radicle-cli/src/commands/patch/review/builder.rs index c7f0a339..05427305 100644 --- a/crates/radicle-cli/src/commands/patch/review/builder.rs +++ b/crates/radicle-cli/src/commands/patch/review/builder.rs @@ -455,7 +455,7 @@ impl FileReviewBuilder { } } - fn item_diff(&mut self, item: ReviewItem) -> Result { + fn item_diff(&mut self, item: ReviewItem) -> Result, Error> { let mut buf = Vec::new(); let mut writer = unified_diff::Writer::new(&mut buf); writer.encode(&self.header)?; diff --git a/crates/radicle-cli/src/git.rs b/crates/radicle-cli/src/git.rs index 1d885a49..aa51aea0 100644 --- a/crates/radicle-cli/src/git.rs +++ b/crates/radicle-cli/src/git.rs @@ -251,7 +251,7 @@ pub fn is_signing_configured(repo: &Path) -> Result { } /// Return the list of radicle remotes for the given repository. -pub fn rad_remotes(repo: &Repository) -> anyhow::Result> { +pub fn rad_remotes(repo: &Repository) -> anyhow::Result>> { let remotes: Vec<_> = repo .remotes()? .iter() @@ -273,7 +273,7 @@ pub fn is_remote(repo: &Repository, alias: &str) -> anyhow::Result { } /// Get the repository's "rad" remote. -pub fn rad_remote(repo: &Repository) -> anyhow::Result<(git::raw::Remote, RepoId)> { +pub fn rad_remote(repo: &Repository) -> anyhow::Result<(git::raw::Remote<'_>, RepoId)> { match radicle::rad::remote(repo) { Ok((remote, id)) => Ok((remote, id)), Err(radicle::rad::RemoteError::NotFound(_)) => Err(anyhow!( diff --git a/crates/radicle-cli/src/project.rs b/crates/radicle-cli/src/project.rs index c7df9945..9d4cb66b 100644 --- a/crates/radicle-cli/src/project.rs +++ b/crates/radicle-cli/src/project.rs @@ -22,7 +22,7 @@ impl SetupRemote<'_> { &self, name: impl AsRef, node: NodeId, - ) -> anyhow::Result<(git::Remote, Option)> { + ) -> anyhow::Result<(git::Remote<'_>, Option)> { let remote_url = radicle::git::Url::from(self.rid).with_namespace(node); let remote_name = name.as_ref(); diff --git a/crates/radicle-cli/src/terminal/patch/common.rs b/crates/radicle-cli/src/terminal/patch/common.rs index 2e9e4217..6768a93b 100644 --- a/crates/radicle-cli/src/terminal/patch/common.rs +++ b/crates/radicle-cli/src/terminal/patch/common.rs @@ -99,7 +99,7 @@ pub fn branches(target: &Oid, repo: &git::raw::Repository) -> anyhow::Result) -> anyhow::Result { +pub fn try_branch(reference: git::raw::Reference<'_>) -> anyhow::Result> { let branch = if reference.is_branch() { git::raw::Branch::wrap(reference) } else { diff --git a/crates/radicle-crypto/src/lib.rs b/crates/radicle-crypto/src/lib.rs index dc4085e4..b0a28eff 100644 --- a/crates/radicle-crypto/src/lib.rs +++ b/crates/radicle-crypto/src/lib.rs @@ -360,7 +360,7 @@ impl PublicKey { } #[cfg(feature = "git-ref-format-core")] - pub fn to_component(&self) -> git_ref_format_core::Component { + pub fn to_component(&self) -> git_ref_format_core::Component<'_> { git_ref_format_core::Component::from(self) } diff --git a/crates/radicle-fetch/src/git/repository/error.rs b/crates/radicle-fetch/src/git/repository/error.rs index 49f5f3d0..fe355448 100644 --- a/crates/radicle-fetch/src/git/repository/error.rs +++ b/crates/radicle-fetch/src/git/repository/error.rs @@ -42,14 +42,6 @@ pub struct Resolve { pub err: git::raw::Error, } -#[derive(Debug, Error)] -#[error("failed to scan for refs matching {pattern}")] -pub struct Scan { - pub pattern: radicle::git::fmt::refspec::PatternString, - #[source] - pub err: git::raw::Error, -} - #[derive(Debug, Error)] pub enum Update { #[error(transparent)] diff --git a/crates/radicle-git-metadata/src/commit.rs b/crates/radicle-git-metadata/src/commit.rs index 62872960..5ccab788 100644 --- a/crates/radicle-git-metadata/src/commit.rs +++ b/crates/radicle-git-metadata/src/commit.rs @@ -81,7 +81,7 @@ impl CommitData { /// The [`Signature`]s found in this commit, i.e. the headers corresponding /// to `gpgsig`. - pub fn signatures(&self) -> impl Iterator + '_ { + pub fn signatures(&self) -> impl Iterator> + '_ { self.headers.signatures() } diff --git a/crates/radicle-git-metadata/src/commit/headers.rs b/crates/radicle-git-metadata/src/commit/headers.rs index 172a884d..35ac01b8 100644 --- a/crates/radicle-git-metadata/src/commit/headers.rs +++ b/crates/radicle-git-metadata/src/commit/headers.rs @@ -56,7 +56,7 @@ impl Headers { .filter_map(move |(k, v)| (k == name).then_some(v)) } - pub fn signatures(&self) -> impl Iterator + '_ { + pub fn signatures(&self) -> impl Iterator> + '_ { self.0.iter().filter_map(|(k, v)| { if k == "gpgsig" { Signature::from_str(v).ok() diff --git a/crates/radicle-node/src/wire.rs b/crates/radicle-node/src/wire.rs index 1cb4b330..4103cafd 100644 --- a/crates/radicle-node/src/wire.rs +++ b/crates/radicle-node/src/wire.rs @@ -241,7 +241,7 @@ impl Peers { self.0.get_mut(token) } - fn entry(&mut self, token: Token) -> Entry { + fn entry(&mut self, token: Token) -> Entry<'_, Token, Peer> { self.0.entry(token) } diff --git a/crates/radicle-protocol/src/bounded.rs b/crates/radicle-protocol/src/bounded.rs index 1687de4b..06e51aa0 100644 --- a/crates/radicle-protocol/src/bounded.rs +++ b/crates/radicle-protocol/src/bounded.rs @@ -160,7 +160,7 @@ impl BoundedVec { } /// Calls [`std::vec::Drain`]. - pub fn drain>(&mut self, range: R) -> std::vec::Drain { + pub fn drain>(&mut self, range: R) -> std::vec::Drain<'_, T> { self.v.drain(range) } } diff --git a/crates/radicle-protocol/src/service.rs b/crates/radicle-protocol/src/service.rs index c0202a45..566db52b 100644 --- a/crates/radicle-protocol/src/service.rs +++ b/crates/radicle-protocol/src/service.rs @@ -1086,7 +1086,7 @@ where from: &NodeId, refs_at: Vec, timeout: time::Duration, - ) -> Result<&mut FetchState, TryFetchError> { + ) -> Result<&mut FetchState, TryFetchError<'_>> { let from = *from; let Some(session) = self.sessions.get_mut(&from) else { return Err(TryFetchError::SessionNotConnected); diff --git a/crates/radicle-remote-helper/src/main.rs b/crates/radicle-remote-helper/src/main.rs index e5240fa7..e1c85d90 100644 --- a/crates/radicle-remote-helper/src/main.rs +++ b/crates/radicle-remote-helper/src/main.rs @@ -171,7 +171,10 @@ pub enum Branch { impl Branch { /// Return the branch name to be used for the local branch when creating a /// patch. - pub fn to_branch_name(self, object: &radicle::patch::PatchId) -> Option { + pub fn to_branch_name( + self, + object: &radicle::patch::PatchId, + ) -> Option> { match self { Self::None => None, Self::MirrorUpstream => Some(git::refs::patch(object)), diff --git a/crates/radicle-ssh/src/encoding.rs b/crates/radicle-ssh/src/encoding.rs index a4599437..b3ebf647 100644 --- a/crates/radicle-ssh/src/encoding.rs +++ b/crates/radicle-ssh/src/encoding.rs @@ -167,11 +167,11 @@ impl Encoding for Buffer { /// A cursor-like trait to read SSH-encoded things. pub trait Reader { /// Create an SSH reader for `self`. - fn reader(&self, starting_at: usize) -> Cursor; + fn reader(&self, starting_at: usize) -> Cursor<'_>; } impl Reader for Buffer { - fn reader(&self, starting_at: usize) -> Cursor { + fn reader(&self, starting_at: usize) -> Cursor<'_> { Cursor { s: self, position: starting_at, @@ -180,7 +180,7 @@ impl Reader for Buffer { } impl Reader for [u8] { - fn reader(&self, starting_at: usize) -> Cursor { + fn reader(&self, starting_at: usize) -> Cursor<'_> { Cursor { s: self, position: starting_at, diff --git a/crates/radicle/src/cob/identity.rs b/crates/radicle/src/cob/identity.rs index 1d0e81fd..63c28e0f 100644 --- a/crates/radicle/src/cob/identity.rs +++ b/crates/radicle/src/cob/identity.rs @@ -271,7 +271,7 @@ impl Identity { pub fn load_mut>( repo: &R, - ) -> Result, RepositoryError> { + ) -> Result, RepositoryError> { let oid = repo.identity_root()?; let oid = ObjectId::from(oid); diff --git a/crates/radicle/src/cob/issue.rs b/crates/radicle/src/cob/issue.rs index 1958bbf9..9933915f 100644 --- a/crates/radicle/src/cob/issue.rs +++ b/crates/radicle/src/cob/issue.rs @@ -1390,7 +1390,7 @@ mod test { .create( cob::Title::new("My first issue").unwrap(), "Blah blah blah.", - &[ux_label.clone()], + std::slice::from_ref(&ux_label), &[], [], &node.signer, diff --git a/crates/radicle/src/cob/patch.rs b/crates/radicle/src/cob/patch.rs index 65f6304b..78389ac3 100644 --- a/crates/radicle/src/cob/patch.rs +++ b/crates/radicle/src/cob/patch.rs @@ -561,7 +561,7 @@ impl Patch { author: &'a PublicKey, ) -> impl DoubleEndedIterator { self.revisions() - .filter(move |(_, r)| (r.author.public_key() == author)) + .filter(move |(_, r)| r.author.public_key() == author) } /// List of patch reviews of the given revision. @@ -2422,7 +2422,7 @@ where revision: RevisionId, commit: git::Oid, signer: &Device, - ) -> Result, Error> + ) -> Result, Error> where G: crypto::signature::Signer, { diff --git a/crates/radicle/src/git.rs b/crates/radicle/src/git.rs index 45f1b917..3a9c2d18 100644 --- a/crates/radicle/src/git.rs +++ b/crates/radicle/src/git.rs @@ -287,7 +287,7 @@ pub mod refs { /// /// `refs/namespaces//refs/rad/id` /// - pub fn id(remote: &RemoteId) -> Namespaced { + pub fn id(remote: &RemoteId) -> Namespaced<'_> { IDENTITY_BRANCH.with_namespace(remote.into()) } @@ -295,7 +295,7 @@ pub mod refs { /// /// `refs/namespaces//refs/rad/root` /// - pub fn id_root(remote: &RemoteId) -> Namespaced { + pub fn id_root(remote: &RemoteId) -> Namespaced<'_> { IDENTITY_ROOT.with_namespace(remote.into()) } @@ -304,7 +304,7 @@ pub mod refs { /// /// `refs/namespaces//refs/rad/sigrefs` /// - pub fn sigrefs(remote: &RemoteId) -> Namespaced { + pub fn sigrefs(remote: &RemoteId) -> Namespaced<'_> { SIGREFS_BRANCH.with_namespace(remote.into()) } @@ -488,7 +488,7 @@ pub fn remote_refs(url: &Url) -> Result, ListRefsError /// The `T` can be specified when calling the function. For example, if you /// wanted to parse the namespace as a `PublicKey`, then you would the function /// like so, `parse_ref_namespaced::(s)`. -pub fn parse_ref_namespaced(s: &str) -> Result<(T, fmt::Qualified), RefError> +pub fn parse_ref_namespaced(s: &str) -> Result<(T, fmt::Qualified<'_>), RefError> where T: FromStr, T::Err: std::error::Error + Send + Sync + 'static, @@ -517,7 +517,7 @@ where /// The `T` can be specified when calling the function. For example, if you /// wanted to parse the namespace as a `PublicKey`, then you would the function /// like so, `parse_ref::(s)`. -pub fn parse_ref(s: &str) -> Result<(Option, fmt::Qualified), RefError> +pub fn parse_ref(s: &str) -> Result<(Option, fmt::Qualified<'_>), RefError> where T: FromStr, T::Err: std::error::Error + Send + Sync + 'static, @@ -590,7 +590,7 @@ pub fn empty_commit<'a>( } /// Get the repository head. -pub fn head(repo: &raw::Repository) -> Result { +pub fn head(repo: &raw::Repository) -> Result, raw::Error> { let head = repo.head()?.peel_to_commit()?; Ok(head) diff --git a/crates/radicle/src/git/canonical/rules.rs b/crates/radicle/src/git/canonical/rules.rs index 9e32928c..dee71a46 100644 --- a/crates/radicle/src/git/canonical/rules.rs +++ b/crates/radicle/src/git/canonical/rules.rs @@ -514,7 +514,7 @@ pub struct MatchedRule<'a> { impl MatchedRule<'_> { /// Return the reference name that was used for checking if it was a match. - pub fn refname(&self) -> &Qualified { + pub fn refname(&self) -> &Qualified<'_> { &self.refname } diff --git a/crates/radicle/src/identity/doc.rs b/crates/radicle/src/identity/doc.rs index a28d3726..867a61f1 100644 --- a/crates/radicle/src/identity/doc.rs +++ b/crates/radicle/src/identity/doc.rs @@ -42,7 +42,7 @@ pub const MAX_STRING_LENGTH: usize = 255; pub const MAX_DELEGATES: usize = 255; /// The current, most recent version of the identity document. // SAFETY: identity version should never be 0, so we can use `unsafe` here -pub const IDENTITY_VERSION: Version = Version(unsafe { NonZeroU32::new_unchecked(1) }); +pub const IDENTITY_VERSION: Version = Version(NonZeroU32::new(1).unwrap()); #[derive(Error, Debug)] pub enum DocError { @@ -827,7 +827,7 @@ impl Doc { pub(crate) fn blob_at( commit: Oid, repo: &R, - ) -> Result { + ) -> Result, DocError> { let path = Path::new("embeds").join(*PATH); repo.blob_at(commit, path.as_path()).map_err(DocError::from) } diff --git a/crates/radicle/src/storage.rs b/crates/radicle/src/storage.rs index 37acaf17..165eeb58 100644 --- a/crates/radicle/src/storage.rs +++ b/crates/radicle/src/storage.rs @@ -505,10 +505,10 @@ pub trait ReadRepository: Sized + ValidateRepository { &self, commit: Oid, path: P, - ) -> Result; + ) -> Result, crate::git::raw::Error>; /// Get a blob in this repository, given its id. - fn blob(&self, oid: Oid) -> Result; + fn blob(&self, oid: Oid) -> Result, crate::git::raw::Error>; /// Get the head of this repository. /// @@ -516,14 +516,14 @@ pub trait ReadRepository: Sized + ValidateRepository { /// head using [`ReadRepository::canonical_head`]. /// /// Returns the [`Oid`] as well as the qualified reference name. - fn head(&self) -> Result<(Qualified, Oid), RepositoryError>; + fn head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>; /// Compute the canonical head of this repository. /// /// Ignores any existing `HEAD` reference. /// /// Returns the [`Oid`] as well as the qualified reference name. - fn canonical_head(&self) -> Result<(Qualified, Oid), RepositoryError>; + fn canonical_head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError>; /// Get the head of the `rad/id` reference in this repository. /// @@ -568,15 +568,15 @@ pub trait ReadRepository: Sized + ValidateRepository { &self, remote: &RemoteId, reference: &Qualified, - ) -> Result; + ) -> Result, crate::git::raw::Error>; /// Get the [`crate::git::raw::Commit`] found using its `oid`. /// /// Returns `Err` if the commit did not exist. - fn commit(&self, oid: Oid) -> Result; + fn commit(&self, oid: Oid) -> Result, crate::git::raw::Error>; /// Perform a revision walk of a commit history starting from the given head. - fn revwalk(&self, head: Oid) -> Result; + fn revwalk(&self, head: Oid) -> Result, crate::git::raw::Error>; /// Check if the underlying ODB contains the given `oid`. fn contains(&self, oid: Oid) -> Result; @@ -602,7 +602,7 @@ pub trait ReadRepository: Sized + ValidateRepository { fn references_glob( &self, pattern: &crate::git::fmt::refspec::PatternStr, - ) -> Result, crate::git::raw::Error>; + ) -> Result, Oid)>, crate::git::raw::Error>; /// Get repository delegates. fn delegates(&self) -> Result, RepositoryError> { diff --git a/crates/radicle/src/storage/git.rs b/crates/radicle/src/storage/git.rs index faf5f29e..f2592805 100644 --- a/crates/radicle/src/storage/git.rs +++ b/crates/radicle/src/storage/git.rs @@ -667,7 +667,7 @@ impl ReadRepository for Repository { &self, commit_id: Oid, path: P, - ) -> Result { + ) -> Result, git::raw::Error> { let commit = self.backend.find_commit(git::raw::Oid::from(commit_id))?; let tree = commit.tree()?; let entry = tree.get_path(path.as_ref())?; @@ -683,7 +683,7 @@ impl ReadRepository for Repository { Ok(blob) } - fn blob(&self, oid: Oid) -> Result { + fn blob(&self, oid: Oid) -> Result, git::raw::Error> { self.backend.find_blob(oid.into()) } @@ -691,7 +691,7 @@ impl ReadRepository for Repository { &self, remote: &RemoteId, name: &git::fmt::Qualified, - ) -> Result { + ) -> Result, git::raw::Error> { let name = name.with_namespace(remote.into()); self.backend.find_reference(&name) } @@ -707,11 +707,11 @@ impl ReadRepository for Repository { Ok(oid.into()) } - fn commit(&self, oid: Oid) -> Result { + fn commit(&self, oid: Oid) -> Result, git::raw::Error> { self.backend.find_commit(oid.into()) } - fn revwalk(&self, head: Oid) -> Result { + fn revwalk(&self, head: Oid) -> Result, git::raw::Error> { let mut revwalk = self.backend.revwalk()?; revwalk.push(head.into())?; @@ -760,7 +760,7 @@ impl ReadRepository for Repository { fn references_glob( &self, pattern: &PatternStr, - ) -> Result, crate::git::raw::Error> { + ) -> Result, Oid)>, crate::git::raw::Error> { let mut refs = Vec::new(); for r in self.backend.references_glob(pattern)? { @@ -785,7 +785,7 @@ impl ReadRepository for Repository { Doc::load_at(head, self) } - fn head(&self) -> Result<(Qualified, Oid), RepositoryError> { + fn head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError> { // If `HEAD` is already set locally, just return that. if let Ok(head) = self.backend.head() { if let Ok((name, oid)) = git::refs::qualified_from(&head) { @@ -795,7 +795,7 @@ impl ReadRepository for Repository { self.canonical_head() } - fn canonical_head(&self) -> Result<(Qualified, Oid), RepositoryError> { + fn canonical_head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError> { let doc = self.identity_doc()?; let refname = git::refs::branch(doc.project()?.default_branch()); let crefs = match doc.canonical_refs()? { diff --git a/crates/radicle/src/storage/git/cob.rs b/crates/radicle/src/storage/git/cob.rs index 1c612bd2..4676c315 100644 --- a/crates/radicle/src/storage/git/cob.rs +++ b/crates/radicle/src/storage/git/cob.rs @@ -277,11 +277,11 @@ impl ReadRepository for DraftStore<'_, R> { self.repo.is_empty() } - fn head(&self) -> Result<(Qualified, Oid), RepositoryError> { + fn head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError> { self.repo.head() } - fn canonical_head(&self) -> Result<(Qualified, Oid), RepositoryError> { + fn canonical_head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError> { self.repo.canonical_head() } @@ -289,11 +289,11 @@ impl ReadRepository for DraftStore<'_, R> { self.repo.path() } - fn commit(&self, oid: Oid) -> Result { + fn commit(&self, oid: Oid) -> Result, git::raw::Error> { self.repo.commit(oid) } - fn revwalk(&self, head: Oid) -> Result { + fn revwalk(&self, head: Oid) -> Result, git::raw::Error> { self.repo.revwalk(head) } @@ -309,11 +309,11 @@ impl ReadRepository for DraftStore<'_, R> { &self, oid: Oid, path: P, - ) -> Result { + ) -> Result, git::raw::Error> { self.repo.blob_at(oid, path) } - fn blob(&self, oid: Oid) -> Result { + fn blob(&self, oid: Oid) -> Result, crate::git::raw::Error> { self.repo.blob(oid) } @@ -321,7 +321,7 @@ impl ReadRepository for DraftStore<'_, R> { &self, remote: &RemoteId, reference: &git::fmt::Qualified, - ) -> Result { + ) -> Result, git::raw::Error> { self.repo.reference(remote, reference) } @@ -340,7 +340,7 @@ impl ReadRepository for DraftStore<'_, R> { fn references_glob( &self, pattern: &git::fmt::refspec::PatternStr, - ) -> Result, crate::git::raw::Error> { + ) -> Result, Oid)>, crate::git::raw::Error> { self.repo.references_glob(pattern) } diff --git a/crates/radicle/src/storage/refs.rs b/crates/radicle/src/storage/refs.rs index 585e36be..5c39e254 100644 --- a/crates/radicle/src/storage/refs.rs +++ b/crates/radicle/src/storage/refs.rs @@ -398,7 +398,7 @@ impl RefsAt { SignedRefsAt::load_at(self.at, self.remote, repo) } - pub fn path(&self) -> &git::fmt::Qualified { + pub fn path(&self) -> &git::fmt::Qualified<'_> { &SIGREFS_BRANCH } } diff --git a/crates/radicle/src/test/fixtures.rs b/crates/radicle/src/test/fixtures.rs index 66fc00ae..33c930d8 100644 --- a/crates/radicle/src/test/fixtures.rs +++ b/crates/radicle/src/test/fixtures.rs @@ -205,7 +205,7 @@ pub fn tag( } /// Populate a repository with commits, branches and blobs. -pub fn populate(repo: &git::raw::Repository, scale: usize) -> Vec { +pub fn populate(repo: &git::raw::Repository, scale: usize) -> Vec> { assert!( scale <= 8, "Scale parameter must be less than or equal to 8" diff --git a/crates/radicle/src/test/storage.rs b/crates/radicle/src/test/storage.rs index 11f32077..36454800 100644 --- a/crates/radicle/src/test/storage.rs +++ b/crates/radicle/src/test/storage.rs @@ -204,11 +204,11 @@ impl ReadRepository for MockRepository { Ok(self.remotes.is_empty()) } - fn head(&self) -> Result<(fmt::Qualified, Oid), RepositoryError> { + fn head(&self) -> Result<(fmt::Qualified<'_>, Oid), RepositoryError> { Ok((fmt::qualified!("refs/heads/master"), arbitrary::oid())) } - fn canonical_head(&self) -> Result<(fmt::Qualified, Oid), RepositoryError> { + fn canonical_head(&self) -> Result<(fmt::Qualified<'_>, Oid), RepositoryError> { todo!() } @@ -216,7 +216,7 @@ impl ReadRepository for MockRepository { todo!() } - fn commit(&self, oid: Oid) -> Result { + fn commit(&self, oid: Oid) -> Result, git::raw::Error> { Err(git::raw::Error::new( git::raw::ErrorCode::NotFound, git::raw::ErrorClass::None, @@ -224,7 +224,7 @@ impl ReadRepository for MockRepository { )) } - fn revwalk(&self, _head: Oid) -> Result { + fn revwalk(&self, _head: Oid) -> Result, git::raw::Error> { todo!() } @@ -239,7 +239,7 @@ impl ReadRepository for MockRepository { Ok(true) } - fn blob(&self, _oid: Oid) -> Result { + fn blob(&self, _oid: Oid) -> Result, git::raw::Error> { todo!() } @@ -247,7 +247,7 @@ impl ReadRepository for MockRepository { &self, _oid: Oid, _path: P, - ) -> Result { + ) -> Result, git::raw::Error> { todo!() } @@ -255,7 +255,7 @@ impl ReadRepository for MockRepository { &self, _remote: &RemoteId, _reference: &git::fmt::Qualified, - ) -> Result { + ) -> Result, git::raw::Error> { todo!() } @@ -287,7 +287,7 @@ impl ReadRepository for MockRepository { fn references_glob( &self, _pattern: &crate::git::fmt::refspec::PatternStr, - ) -> Result, crate::git::raw::Error> { + ) -> Result, Oid)>, crate::git::raw::Error> { todo!() }