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".
This commit is contained in:
parent
e1b4065353
commit
b0beef4391
|
|
@ -455,7 +455,7 @@ impl FileReviewBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn item_diff(&mut self, item: ReviewItem) -> Result<git::raw::Diff, Error> {
|
fn item_diff(&mut self, item: ReviewItem) -> Result<git::raw::Diff<'_>, Error> {
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
let mut writer = unified_diff::Writer::new(&mut buf);
|
let mut writer = unified_diff::Writer::new(&mut buf);
|
||||||
writer.encode(&self.header)?;
|
writer.encode(&self.header)?;
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,7 @@ pub fn is_signing_configured(repo: &Path) -> Result<bool, anyhow::Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the list of radicle remotes for the given repository.
|
/// Return the list of radicle remotes for the given repository.
|
||||||
pub fn rad_remotes(repo: &Repository) -> anyhow::Result<Vec<Remote>> {
|
pub fn rad_remotes(repo: &Repository) -> anyhow::Result<Vec<Remote<'_>>> {
|
||||||
let remotes: Vec<_> = repo
|
let remotes: Vec<_> = repo
|
||||||
.remotes()?
|
.remotes()?
|
||||||
.iter()
|
.iter()
|
||||||
|
|
@ -273,7 +273,7 @@ pub fn is_remote(repo: &Repository, alias: &str) -> anyhow::Result<bool> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the repository's "rad" remote.
|
/// 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) {
|
match radicle::rad::remote(repo) {
|
||||||
Ok((remote, id)) => Ok((remote, id)),
|
Ok((remote, id)) => Ok((remote, id)),
|
||||||
Err(radicle::rad::RemoteError::NotFound(_)) => Err(anyhow!(
|
Err(radicle::rad::RemoteError::NotFound(_)) => Err(anyhow!(
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ impl SetupRemote<'_> {
|
||||||
&self,
|
&self,
|
||||||
name: impl AsRef<RefStr>,
|
name: impl AsRef<RefStr>,
|
||||||
node: NodeId,
|
node: NodeId,
|
||||||
) -> anyhow::Result<(git::Remote, Option<BranchName>)> {
|
) -> anyhow::Result<(git::Remote<'_>, Option<BranchName>)> {
|
||||||
let remote_url = radicle::git::Url::from(self.rid).with_namespace(node);
|
let remote_url = radicle::git::Url::from(self.rid).with_namespace(node);
|
||||||
let remote_name = name.as_ref();
|
let remote_name = name.as_ref();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ pub fn branches(target: &Oid, repo: &git::raw::Repository) -> anyhow::Result<Vec
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn try_branch(reference: git::raw::Reference<'_>) -> anyhow::Result<git::raw::Branch> {
|
pub fn try_branch(reference: git::raw::Reference<'_>) -> anyhow::Result<git::raw::Branch<'_>> {
|
||||||
let branch = if reference.is_branch() {
|
let branch = if reference.is_branch() {
|
||||||
git::raw::Branch::wrap(reference)
|
git::raw::Branch::wrap(reference)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -360,7 +360,7 @@ impl PublicKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "git-ref-format-core")]
|
#[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)
|
git_ref_format_core::Component::from(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,14 +42,6 @@ pub struct Resolve {
|
||||||
pub err: git::raw::Error,
|
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)]
|
#[derive(Debug, Error)]
|
||||||
pub enum Update {
|
pub enum Update {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ impl<Tree, Parent> CommitData<Tree, Parent> {
|
||||||
|
|
||||||
/// The [`Signature`]s found in this commit, i.e. the headers corresponding
|
/// The [`Signature`]s found in this commit, i.e. the headers corresponding
|
||||||
/// to `gpgsig`.
|
/// to `gpgsig`.
|
||||||
pub fn signatures(&self) -> impl Iterator<Item = Signature> + '_ {
|
pub fn signatures(&self) -> impl Iterator<Item = Signature<'_>> + '_ {
|
||||||
self.headers.signatures()
|
self.headers.signatures()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ impl Headers {
|
||||||
.filter_map(move |(k, v)| (k == name).then_some(v))
|
.filter_map(move |(k, v)| (k == name).then_some(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn signatures(&self) -> impl Iterator<Item = Signature> + '_ {
|
pub fn signatures(&self) -> impl Iterator<Item = Signature<'_>> + '_ {
|
||||||
self.0.iter().filter_map(|(k, v)| {
|
self.0.iter().filter_map(|(k, v)| {
|
||||||
if k == "gpgsig" {
|
if k == "gpgsig" {
|
||||||
Signature::from_str(v).ok()
|
Signature::from_str(v).ok()
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ impl Peers {
|
||||||
self.0.get_mut(token)
|
self.0.get_mut(token)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn entry(&mut self, token: Token) -> Entry<Token, Peer> {
|
fn entry(&mut self, token: Token) -> Entry<'_, Token, Peer> {
|
||||||
self.0.entry(token)
|
self.0.entry(token)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ impl<T, const N: usize> BoundedVec<T, N> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Calls [`std::vec::Drain`].
|
/// Calls [`std::vec::Drain`].
|
||||||
pub fn drain<R: RangeBounds<usize>>(&mut self, range: R) -> std::vec::Drain<T> {
|
pub fn drain<R: RangeBounds<usize>>(&mut self, range: R) -> std::vec::Drain<'_, T> {
|
||||||
self.v.drain(range)
|
self.v.drain(range)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1086,7 +1086,7 @@ where
|
||||||
from: &NodeId,
|
from: &NodeId,
|
||||||
refs_at: Vec<RefsAt>,
|
refs_at: Vec<RefsAt>,
|
||||||
timeout: time::Duration,
|
timeout: time::Duration,
|
||||||
) -> Result<&mut FetchState, TryFetchError> {
|
) -> Result<&mut FetchState, TryFetchError<'_>> {
|
||||||
let from = *from;
|
let from = *from;
|
||||||
let Some(session) = self.sessions.get_mut(&from) else {
|
let Some(session) = self.sessions.get_mut(&from) else {
|
||||||
return Err(TryFetchError::SessionNotConnected);
|
return Err(TryFetchError::SessionNotConnected);
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,10 @@ pub enum Branch {
|
||||||
impl Branch {
|
impl Branch {
|
||||||
/// Return the branch name to be used for the local branch when creating a
|
/// Return the branch name to be used for the local branch when creating a
|
||||||
/// patch.
|
/// patch.
|
||||||
pub fn to_branch_name(self, object: &radicle::patch::PatchId) -> Option<git::fmt::Qualified> {
|
pub fn to_branch_name(
|
||||||
|
self,
|
||||||
|
object: &radicle::patch::PatchId,
|
||||||
|
) -> Option<git::fmt::Qualified<'_>> {
|
||||||
match self {
|
match self {
|
||||||
Self::None => None,
|
Self::None => None,
|
||||||
Self::MirrorUpstream => Some(git::refs::patch(object)),
|
Self::MirrorUpstream => Some(git::refs::patch(object)),
|
||||||
|
|
|
||||||
|
|
@ -167,11 +167,11 @@ impl Encoding for Buffer {
|
||||||
/// A cursor-like trait to read SSH-encoded things.
|
/// A cursor-like trait to read SSH-encoded things.
|
||||||
pub trait Reader {
|
pub trait Reader {
|
||||||
/// Create an SSH reader for `self`.
|
/// Create an SSH reader for `self`.
|
||||||
fn reader(&self, starting_at: usize) -> Cursor;
|
fn reader(&self, starting_at: usize) -> Cursor<'_>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Reader for Buffer {
|
impl Reader for Buffer {
|
||||||
fn reader(&self, starting_at: usize) -> Cursor {
|
fn reader(&self, starting_at: usize) -> Cursor<'_> {
|
||||||
Cursor {
|
Cursor {
|
||||||
s: self,
|
s: self,
|
||||||
position: starting_at,
|
position: starting_at,
|
||||||
|
|
@ -180,7 +180,7 @@ impl Reader for Buffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Reader for [u8] {
|
impl Reader for [u8] {
|
||||||
fn reader(&self, starting_at: usize) -> Cursor {
|
fn reader(&self, starting_at: usize) -> Cursor<'_> {
|
||||||
Cursor {
|
Cursor {
|
||||||
s: self,
|
s: self,
|
||||||
position: starting_at,
|
position: starting_at,
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,7 @@ impl Identity {
|
||||||
|
|
||||||
pub fn load_mut<R: WriteRepository + cob::Store<Namespace = NodeId>>(
|
pub fn load_mut<R: WriteRepository + cob::Store<Namespace = NodeId>>(
|
||||||
repo: &R,
|
repo: &R,
|
||||||
) -> Result<IdentityMut<R>, RepositoryError> {
|
) -> Result<IdentityMut<'_, R>, RepositoryError> {
|
||||||
let oid = repo.identity_root()?;
|
let oid = repo.identity_root()?;
|
||||||
let oid = ObjectId::from(oid);
|
let oid = ObjectId::from(oid);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1390,7 +1390,7 @@ mod test {
|
||||||
.create(
|
.create(
|
||||||
cob::Title::new("My first issue").unwrap(),
|
cob::Title::new("My first issue").unwrap(),
|
||||||
"Blah blah blah.",
|
"Blah blah blah.",
|
||||||
&[ux_label.clone()],
|
std::slice::from_ref(&ux_label),
|
||||||
&[],
|
&[],
|
||||||
[],
|
[],
|
||||||
&node.signer,
|
&node.signer,
|
||||||
|
|
|
||||||
|
|
@ -561,7 +561,7 @@ impl Patch {
|
||||||
author: &'a PublicKey,
|
author: &'a PublicKey,
|
||||||
) -> impl DoubleEndedIterator<Item = (RevisionId, &'a Revision)> {
|
) -> impl DoubleEndedIterator<Item = (RevisionId, &'a Revision)> {
|
||||||
self.revisions()
|
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.
|
/// List of patch reviews of the given revision.
|
||||||
|
|
@ -2422,7 +2422,7 @@ where
|
||||||
revision: RevisionId,
|
revision: RevisionId,
|
||||||
commit: git::Oid,
|
commit: git::Oid,
|
||||||
signer: &Device<G>,
|
signer: &Device<G>,
|
||||||
) -> Result<Merged<R>, Error>
|
) -> Result<Merged<'_, R>, Error>
|
||||||
where
|
where
|
||||||
G: crypto::signature::Signer<crypto::Signature>,
|
G: crypto::signature::Signer<crypto::Signature>,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,7 @@ pub mod refs {
|
||||||
///
|
///
|
||||||
/// `refs/namespaces/<remote>/refs/rad/id`
|
/// `refs/namespaces/<remote>/refs/rad/id`
|
||||||
///
|
///
|
||||||
pub fn id(remote: &RemoteId) -> Namespaced {
|
pub fn id(remote: &RemoteId) -> Namespaced<'_> {
|
||||||
IDENTITY_BRANCH.with_namespace(remote.into())
|
IDENTITY_BRANCH.with_namespace(remote.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -295,7 +295,7 @@ pub mod refs {
|
||||||
///
|
///
|
||||||
/// `refs/namespaces/<remote>/refs/rad/root`
|
/// `refs/namespaces/<remote>/refs/rad/root`
|
||||||
///
|
///
|
||||||
pub fn id_root(remote: &RemoteId) -> Namespaced {
|
pub fn id_root(remote: &RemoteId) -> Namespaced<'_> {
|
||||||
IDENTITY_ROOT.with_namespace(remote.into())
|
IDENTITY_ROOT.with_namespace(remote.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -304,7 +304,7 @@ pub mod refs {
|
||||||
///
|
///
|
||||||
/// `refs/namespaces/<remote>/refs/rad/sigrefs`
|
/// `refs/namespaces/<remote>/refs/rad/sigrefs`
|
||||||
///
|
///
|
||||||
pub fn sigrefs(remote: &RemoteId) -> Namespaced {
|
pub fn sigrefs(remote: &RemoteId) -> Namespaced<'_> {
|
||||||
SIGREFS_BRANCH.with_namespace(remote.into())
|
SIGREFS_BRANCH.with_namespace(remote.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -488,7 +488,7 @@ pub fn remote_refs(url: &Url) -> Result<RandomMap<RemoteId, Refs>, ListRefsError
|
||||||
/// The `T` can be specified when calling the function. For example, if you
|
/// 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
|
/// wanted to parse the namespace as a `PublicKey`, then you would the function
|
||||||
/// like so, `parse_ref_namespaced::<PublicKey>(s)`.
|
/// like so, `parse_ref_namespaced::<PublicKey>(s)`.
|
||||||
pub fn parse_ref_namespaced<T>(s: &str) -> Result<(T, fmt::Qualified), RefError>
|
pub fn parse_ref_namespaced<T>(s: &str) -> Result<(T, fmt::Qualified<'_>), RefError>
|
||||||
where
|
where
|
||||||
T: FromStr,
|
T: FromStr,
|
||||||
T::Err: std::error::Error + Send + Sync + 'static,
|
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
|
/// 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
|
/// wanted to parse the namespace as a `PublicKey`, then you would the function
|
||||||
/// like so, `parse_ref::<PublicKey>(s)`.
|
/// like so, `parse_ref::<PublicKey>(s)`.
|
||||||
pub fn parse_ref<T>(s: &str) -> Result<(Option<T>, fmt::Qualified), RefError>
|
pub fn parse_ref<T>(s: &str) -> Result<(Option<T>, fmt::Qualified<'_>), RefError>
|
||||||
where
|
where
|
||||||
T: FromStr,
|
T: FromStr,
|
||||||
T::Err: std::error::Error + Send + Sync + 'static,
|
T::Err: std::error::Error + Send + Sync + 'static,
|
||||||
|
|
@ -590,7 +590,7 @@ pub fn empty_commit<'a>(
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the repository head.
|
/// Get the repository head.
|
||||||
pub fn head(repo: &raw::Repository) -> Result<raw::Commit, raw::Error> {
|
pub fn head(repo: &raw::Repository) -> Result<raw::Commit<'_>, raw::Error> {
|
||||||
let head = repo.head()?.peel_to_commit()?;
|
let head = repo.head()?.peel_to_commit()?;
|
||||||
|
|
||||||
Ok(head)
|
Ok(head)
|
||||||
|
|
|
||||||
|
|
@ -514,7 +514,7 @@ pub struct MatchedRule<'a> {
|
||||||
|
|
||||||
impl MatchedRule<'_> {
|
impl MatchedRule<'_> {
|
||||||
/// Return the reference name that was used for checking if it was a match.
|
/// 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
|
&self.refname
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ pub const MAX_STRING_LENGTH: usize = 255;
|
||||||
pub const MAX_DELEGATES: usize = 255;
|
pub const MAX_DELEGATES: usize = 255;
|
||||||
/// The current, most recent version of the identity document.
|
/// The current, most recent version of the identity document.
|
||||||
// SAFETY: identity version should never be 0, so we can use `unsafe` here
|
// 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)]
|
#[derive(Error, Debug)]
|
||||||
pub enum DocError {
|
pub enum DocError {
|
||||||
|
|
@ -827,7 +827,7 @@ impl Doc {
|
||||||
pub(crate) fn blob_at<R: ReadRepository>(
|
pub(crate) fn blob_at<R: ReadRepository>(
|
||||||
commit: Oid,
|
commit: Oid,
|
||||||
repo: &R,
|
repo: &R,
|
||||||
) -> Result<git::raw::Blob, DocError> {
|
) -> Result<git::raw::Blob<'_>, DocError> {
|
||||||
let path = Path::new("embeds").join(*PATH);
|
let path = Path::new("embeds").join(*PATH);
|
||||||
repo.blob_at(commit, path.as_path()).map_err(DocError::from)
|
repo.blob_at(commit, path.as_path()).map_err(DocError::from)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -505,10 +505,10 @@ pub trait ReadRepository: Sized + ValidateRepository {
|
||||||
&self,
|
&self,
|
||||||
commit: Oid,
|
commit: Oid,
|
||||||
path: P,
|
path: P,
|
||||||
) -> Result<crate::git::raw::Blob, crate::git::raw::Error>;
|
) -> Result<crate::git::raw::Blob<'_>, crate::git::raw::Error>;
|
||||||
|
|
||||||
/// Get a blob in this repository, given its id.
|
/// Get a blob in this repository, given its id.
|
||||||
fn blob(&self, oid: Oid) -> Result<crate::git::raw::Blob, crate::git::raw::Error>;
|
fn blob(&self, oid: Oid) -> Result<crate::git::raw::Blob<'_>, crate::git::raw::Error>;
|
||||||
|
|
||||||
/// Get the head of this repository.
|
/// Get the head of this repository.
|
||||||
///
|
///
|
||||||
|
|
@ -516,14 +516,14 @@ pub trait ReadRepository: Sized + ValidateRepository {
|
||||||
/// head using [`ReadRepository::canonical_head`].
|
/// head using [`ReadRepository::canonical_head`].
|
||||||
///
|
///
|
||||||
/// Returns the [`Oid`] as well as the qualified reference name.
|
/// 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.
|
/// Compute the canonical head of this repository.
|
||||||
///
|
///
|
||||||
/// Ignores any existing `HEAD` reference.
|
/// Ignores any existing `HEAD` reference.
|
||||||
///
|
///
|
||||||
/// Returns the [`Oid`] as well as the qualified reference name.
|
/// 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.
|
/// Get the head of the `rad/id` reference in this repository.
|
||||||
///
|
///
|
||||||
|
|
@ -568,15 +568,15 @@ pub trait ReadRepository: Sized + ValidateRepository {
|
||||||
&self,
|
&self,
|
||||||
remote: &RemoteId,
|
remote: &RemoteId,
|
||||||
reference: &Qualified,
|
reference: &Qualified,
|
||||||
) -> Result<crate::git::raw::Reference, crate::git::raw::Error>;
|
) -> Result<crate::git::raw::Reference<'_>, crate::git::raw::Error>;
|
||||||
|
|
||||||
/// Get the [`crate::git::raw::Commit`] found using its `oid`.
|
/// Get the [`crate::git::raw::Commit`] found using its `oid`.
|
||||||
///
|
///
|
||||||
/// Returns `Err` if the commit did not exist.
|
/// Returns `Err` if the commit did not exist.
|
||||||
fn commit(&self, oid: Oid) -> Result<crate::git::raw::Commit, crate::git::raw::Error>;
|
fn commit(&self, oid: Oid) -> Result<crate::git::raw::Commit<'_>, crate::git::raw::Error>;
|
||||||
|
|
||||||
/// Perform a revision walk of a commit history starting from the given head.
|
/// Perform a revision walk of a commit history starting from the given head.
|
||||||
fn revwalk(&self, head: Oid) -> Result<crate::git::raw::Revwalk, crate::git::raw::Error>;
|
fn revwalk(&self, head: Oid) -> Result<crate::git::raw::Revwalk<'_>, crate::git::raw::Error>;
|
||||||
|
|
||||||
/// Check if the underlying ODB contains the given `oid`.
|
/// Check if the underlying ODB contains the given `oid`.
|
||||||
fn contains(&self, oid: Oid) -> Result<bool, crate::git::raw::Error>;
|
fn contains(&self, oid: Oid) -> Result<bool, crate::git::raw::Error>;
|
||||||
|
|
@ -602,7 +602,7 @@ pub trait ReadRepository: Sized + ValidateRepository {
|
||||||
fn references_glob(
|
fn references_glob(
|
||||||
&self,
|
&self,
|
||||||
pattern: &crate::git::fmt::refspec::PatternStr,
|
pattern: &crate::git::fmt::refspec::PatternStr,
|
||||||
) -> Result<Vec<(Qualified, Oid)>, crate::git::raw::Error>;
|
) -> Result<Vec<(Qualified<'_>, Oid)>, crate::git::raw::Error>;
|
||||||
|
|
||||||
/// Get repository delegates.
|
/// Get repository delegates.
|
||||||
fn delegates(&self) -> Result<NonEmpty<Did>, RepositoryError> {
|
fn delegates(&self) -> Result<NonEmpty<Did>, RepositoryError> {
|
||||||
|
|
|
||||||
|
|
@ -667,7 +667,7 @@ impl ReadRepository for Repository {
|
||||||
&self,
|
&self,
|
||||||
commit_id: Oid,
|
commit_id: Oid,
|
||||||
path: P,
|
path: P,
|
||||||
) -> Result<git::raw::Blob, git::raw::Error> {
|
) -> Result<git::raw::Blob<'_>, git::raw::Error> {
|
||||||
let commit = self.backend.find_commit(git::raw::Oid::from(commit_id))?;
|
let commit = self.backend.find_commit(git::raw::Oid::from(commit_id))?;
|
||||||
let tree = commit.tree()?;
|
let tree = commit.tree()?;
|
||||||
let entry = tree.get_path(path.as_ref())?;
|
let entry = tree.get_path(path.as_ref())?;
|
||||||
|
|
@ -683,7 +683,7 @@ impl ReadRepository for Repository {
|
||||||
Ok(blob)
|
Ok(blob)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn blob(&self, oid: Oid) -> Result<git::raw::Blob, git::raw::Error> {
|
fn blob(&self, oid: Oid) -> Result<git::raw::Blob<'_>, git::raw::Error> {
|
||||||
self.backend.find_blob(oid.into())
|
self.backend.find_blob(oid.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -691,7 +691,7 @@ impl ReadRepository for Repository {
|
||||||
&self,
|
&self,
|
||||||
remote: &RemoteId,
|
remote: &RemoteId,
|
||||||
name: &git::fmt::Qualified,
|
name: &git::fmt::Qualified,
|
||||||
) -> Result<git::raw::Reference, git::raw::Error> {
|
) -> Result<git::raw::Reference<'_>, git::raw::Error> {
|
||||||
let name = name.with_namespace(remote.into());
|
let name = name.with_namespace(remote.into());
|
||||||
self.backend.find_reference(&name)
|
self.backend.find_reference(&name)
|
||||||
}
|
}
|
||||||
|
|
@ -707,11 +707,11 @@ impl ReadRepository for Repository {
|
||||||
Ok(oid.into())
|
Ok(oid.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn commit(&self, oid: Oid) -> Result<git::raw::Commit, git::raw::Error> {
|
fn commit(&self, oid: Oid) -> Result<git::raw::Commit<'_>, git::raw::Error> {
|
||||||
self.backend.find_commit(oid.into())
|
self.backend.find_commit(oid.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn revwalk(&self, head: Oid) -> Result<git::raw::Revwalk, git::raw::Error> {
|
fn revwalk(&self, head: Oid) -> Result<git::raw::Revwalk<'_>, git::raw::Error> {
|
||||||
let mut revwalk = self.backend.revwalk()?;
|
let mut revwalk = self.backend.revwalk()?;
|
||||||
revwalk.push(head.into())?;
|
revwalk.push(head.into())?;
|
||||||
|
|
||||||
|
|
@ -760,7 +760,7 @@ impl ReadRepository for Repository {
|
||||||
fn references_glob(
|
fn references_glob(
|
||||||
&self,
|
&self,
|
||||||
pattern: &PatternStr,
|
pattern: &PatternStr,
|
||||||
) -> Result<Vec<(Qualified, Oid)>, crate::git::raw::Error> {
|
) -> Result<Vec<(Qualified<'_>, Oid)>, crate::git::raw::Error> {
|
||||||
let mut refs = Vec::new();
|
let mut refs = Vec::new();
|
||||||
|
|
||||||
for r in self.backend.references_glob(pattern)? {
|
for r in self.backend.references_glob(pattern)? {
|
||||||
|
|
@ -785,7 +785,7 @@ impl ReadRepository for Repository {
|
||||||
Doc::load_at(head, self)
|
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 `HEAD` is already set locally, just return that.
|
||||||
if let Ok(head) = self.backend.head() {
|
if let Ok(head) = self.backend.head() {
|
||||||
if let Ok((name, oid)) = git::refs::qualified_from(&head) {
|
if let Ok((name, oid)) = git::refs::qualified_from(&head) {
|
||||||
|
|
@ -795,7 +795,7 @@ impl ReadRepository for Repository {
|
||||||
self.canonical_head()
|
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 doc = self.identity_doc()?;
|
||||||
let refname = git::refs::branch(doc.project()?.default_branch());
|
let refname = git::refs::branch(doc.project()?.default_branch());
|
||||||
let crefs = match doc.canonical_refs()? {
|
let crefs = match doc.canonical_refs()? {
|
||||||
|
|
|
||||||
|
|
@ -277,11 +277,11 @@ impl<R: storage::ReadRepository> ReadRepository for DraftStore<'_, R> {
|
||||||
self.repo.is_empty()
|
self.repo.is_empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn head(&self) -> Result<(Qualified, Oid), RepositoryError> {
|
fn head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError> {
|
||||||
self.repo.head()
|
self.repo.head()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn canonical_head(&self) -> Result<(Qualified, Oid), RepositoryError> {
|
fn canonical_head(&self) -> Result<(Qualified<'_>, Oid), RepositoryError> {
|
||||||
self.repo.canonical_head()
|
self.repo.canonical_head()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -289,11 +289,11 @@ impl<R: storage::ReadRepository> ReadRepository for DraftStore<'_, R> {
|
||||||
self.repo.path()
|
self.repo.path()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn commit(&self, oid: Oid) -> Result<git::raw::Commit, git::raw::Error> {
|
fn commit(&self, oid: Oid) -> Result<git::raw::Commit<'_>, git::raw::Error> {
|
||||||
self.repo.commit(oid)
|
self.repo.commit(oid)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn revwalk(&self, head: Oid) -> Result<git::raw::Revwalk, git::raw::Error> {
|
fn revwalk(&self, head: Oid) -> Result<git::raw::Revwalk<'_>, git::raw::Error> {
|
||||||
self.repo.revwalk(head)
|
self.repo.revwalk(head)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -309,11 +309,11 @@ impl<R: storage::ReadRepository> ReadRepository for DraftStore<'_, R> {
|
||||||
&self,
|
&self,
|
||||||
oid: Oid,
|
oid: Oid,
|
||||||
path: P,
|
path: P,
|
||||||
) -> Result<git::raw::Blob, git::raw::Error> {
|
) -> Result<git::raw::Blob<'_>, git::raw::Error> {
|
||||||
self.repo.blob_at(oid, path)
|
self.repo.blob_at(oid, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn blob(&self, oid: Oid) -> Result<crate::git::raw::Blob, crate::git::raw::Error> {
|
fn blob(&self, oid: Oid) -> Result<crate::git::raw::Blob<'_>, crate::git::raw::Error> {
|
||||||
self.repo.blob(oid)
|
self.repo.blob(oid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -321,7 +321,7 @@ impl<R: storage::ReadRepository> ReadRepository for DraftStore<'_, R> {
|
||||||
&self,
|
&self,
|
||||||
remote: &RemoteId,
|
remote: &RemoteId,
|
||||||
reference: &git::fmt::Qualified,
|
reference: &git::fmt::Qualified,
|
||||||
) -> Result<git::raw::Reference, git::raw::Error> {
|
) -> Result<git::raw::Reference<'_>, git::raw::Error> {
|
||||||
self.repo.reference(remote, reference)
|
self.repo.reference(remote, reference)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -340,7 +340,7 @@ impl<R: storage::ReadRepository> ReadRepository for DraftStore<'_, R> {
|
||||||
fn references_glob(
|
fn references_glob(
|
||||||
&self,
|
&self,
|
||||||
pattern: &git::fmt::refspec::PatternStr,
|
pattern: &git::fmt::refspec::PatternStr,
|
||||||
) -> Result<Vec<(fmt::Qualified, Oid)>, crate::git::raw::Error> {
|
) -> Result<Vec<(fmt::Qualified<'_>, Oid)>, crate::git::raw::Error> {
|
||||||
self.repo.references_glob(pattern)
|
self.repo.references_glob(pattern)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -398,7 +398,7 @@ impl RefsAt {
|
||||||
SignedRefsAt::load_at(self.at, self.remote, repo)
|
SignedRefsAt::load_at(self.at, self.remote, repo)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn path(&self) -> &git::fmt::Qualified {
|
pub fn path(&self) -> &git::fmt::Qualified<'_> {
|
||||||
&SIGREFS_BRANCH
|
&SIGREFS_BRANCH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ pub fn tag(
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Populate a repository with commits, branches and blobs.
|
/// Populate a repository with commits, branches and blobs.
|
||||||
pub fn populate(repo: &git::raw::Repository, scale: usize) -> Vec<git::fmt::Qualified> {
|
pub fn populate(repo: &git::raw::Repository, scale: usize) -> Vec<git::fmt::Qualified<'_>> {
|
||||||
assert!(
|
assert!(
|
||||||
scale <= 8,
|
scale <= 8,
|
||||||
"Scale parameter must be less than or equal to 8"
|
"Scale parameter must be less than or equal to 8"
|
||||||
|
|
|
||||||
|
|
@ -204,11 +204,11 @@ impl ReadRepository for MockRepository {
|
||||||
Ok(self.remotes.is_empty())
|
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()))
|
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!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,7 +216,7 @@ impl ReadRepository for MockRepository {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn commit(&self, oid: Oid) -> Result<git::raw::Commit, git::raw::Error> {
|
fn commit(&self, oid: Oid) -> Result<git::raw::Commit<'_>, git::raw::Error> {
|
||||||
Err(git::raw::Error::new(
|
Err(git::raw::Error::new(
|
||||||
git::raw::ErrorCode::NotFound,
|
git::raw::ErrorCode::NotFound,
|
||||||
git::raw::ErrorClass::None,
|
git::raw::ErrorClass::None,
|
||||||
|
|
@ -224,7 +224,7 @@ impl ReadRepository for MockRepository {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn revwalk(&self, _head: Oid) -> Result<git::raw::Revwalk, git::raw::Error> {
|
fn revwalk(&self, _head: Oid) -> Result<git::raw::Revwalk<'_>, git::raw::Error> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -239,7 +239,7 @@ impl ReadRepository for MockRepository {
|
||||||
Ok(true)
|
Ok(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn blob(&self, _oid: Oid) -> Result<git::raw::Blob, git::raw::Error> {
|
fn blob(&self, _oid: Oid) -> Result<git::raw::Blob<'_>, git::raw::Error> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -247,7 +247,7 @@ impl ReadRepository for MockRepository {
|
||||||
&self,
|
&self,
|
||||||
_oid: Oid,
|
_oid: Oid,
|
||||||
_path: P,
|
_path: P,
|
||||||
) -> Result<git::raw::Blob, git::raw::Error> {
|
) -> Result<git::raw::Blob<'_>, git::raw::Error> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,7 +255,7 @@ impl ReadRepository for MockRepository {
|
||||||
&self,
|
&self,
|
||||||
_remote: &RemoteId,
|
_remote: &RemoteId,
|
||||||
_reference: &git::fmt::Qualified,
|
_reference: &git::fmt::Qualified,
|
||||||
) -> Result<git::raw::Reference, git::raw::Error> {
|
) -> Result<git::raw::Reference<'_>, git::raw::Error> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -287,7 +287,7 @@ impl ReadRepository for MockRepository {
|
||||||
fn references_glob(
|
fn references_glob(
|
||||||
&self,
|
&self,
|
||||||
_pattern: &crate::git::fmt::refspec::PatternStr,
|
_pattern: &crate::git::fmt::refspec::PatternStr,
|
||||||
) -> Result<Vec<(fmt::Qualified, Oid)>, crate::git::raw::Error> {
|
) -> Result<Vec<(fmt::Qualified<'_>, Oid)>, crate::git::raw::Error> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue