chore: update rust-toolchain

Update the rust toolchain version to 1.85.

Note that this is not the latest, however, it is the latest available in nixpgs,
so this version is good enough for now.
This commit is contained in:
Fintan Halpenny 2025-04-16 12:02:36 +02:00 committed by Lorenz Leutgeb
parent 47c785b916
commit 96637aca7e
No known key found for this signature in database
41 changed files with 117 additions and 104 deletions

View File

@ -1,10 +1,10 @@
#![allow(clippy::or_fun_call)]
use std::collections::HashMap;
use std::ffi::OsString;
use std::path::{Path, PathBuf};
use std::path::Path;
use std::str::FromStr;
use anyhow::{anyhow, Context as _};
use anyhow::Context as _;
use chrono::prelude::*;
use radicle::identity::RepoId;
@ -114,12 +114,10 @@ impl Args for Options {
if let Ok(val) = RepoId::from_str(&val) {
rid = Some(val);
} else if let Ok(val) = PathBuf::from_str(&val) {
rid = radicle::rad::at(val)
} else {
rid = radicle::rad::at(Path::new(val.as_ref()))
.map(|(_, id)| Some(id))
.context("Supplied argument is not a valid path")?;
} else {
return Err(anyhow!("invalid path or RID '{}'", val));
}
}
_ => return Err(anyhow::anyhow!(arg.unexpected())),

View File

@ -7,7 +7,7 @@ use anyhow::anyhow;
use radicle::node::policy;
use radicle::node::policy::{Policy, Scope};
use radicle::node::Handle;
use radicle::{prelude::*, storage, Node};
use radicle::{prelude::*, Node};
use radicle_term::Element as _;
use crate::commands::rad_sync as sync;
@ -201,7 +201,6 @@ pub fn seeding(profile: &Profile) -> anyhow::Result<()> {
let id = rid.to_string();
let name = storage
.repository(rid)
.map_err(storage::RepositoryError::from)
.and_then(|repo| repo.project().map(|proj| proj.name().to_string()))
.unwrap_or_default();
let scope = policy.scope().unwrap_or_default().to_string();

View File

@ -490,7 +490,7 @@ pub fn fetch(
if settings
.seeds
.iter()
.all(|nid| results.get(nid).map_or(false, |r| r.is_success()))
.all(|nid| results.get(nid).is_some_and(|r| r.is_success()))
{
return Ok(results);
}

View File

@ -117,7 +117,7 @@ impl<'a> Deref for Remote<'a> {
}
}
impl<'a> DerefMut for Remote<'a> {
impl DerefMut for Remote<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}

View File

@ -16,7 +16,7 @@ pub struct SetupRemote<'a> {
pub repo: &'a git::Repository,
}
impl<'a> SetupRemote<'a> {
impl SetupRemote<'_> {
/// Run the setup for the given peer.
pub fn run(
&self,

View File

@ -144,7 +144,7 @@ impl<'a> Identity<'a> {
}
}
impl<'a> fmt::Display for Identity<'a> {
impl fmt::Display for Identity<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let nid = self.profile.id();
let alias = self.profile.aliases().alias(nid);

View File

@ -276,7 +276,7 @@ enum Update<'a> {
Merged { author: Author<'a>, merge: Merge },
}
impl<'a> Update<'a> {
impl Update<'_> {
fn timestamp(&self) -> cob::Timestamp {
match self {
Update::Reviewed { review } => review.timestamp(),

View File

@ -10,7 +10,7 @@ pub struct WeightedGenerator<'a, T, C> {
ctx: C,
}
impl<'a, T, C> Iterator for WeightedGenerator<'a, T, C> {
impl<T, C> Iterator for WeightedGenerator<'_, T, C> {
type Item = T;
fn next(&mut self) -> Option<Self::Item> {

View File

@ -402,7 +402,7 @@ impl Deref for PublicKey {
}
#[cfg(feature = "radicle-git-ext")]
impl<'a> From<&PublicKey> for radicle_git_ext::ref_format::Component<'a> {
impl From<&PublicKey> for radicle_git_ext::ref_format::Component<'_> {
fn from(id: &PublicKey) -> Self {
use radicle_git_ext::ref_format::{Component, RefString};
let refstr =

View File

@ -34,7 +34,7 @@ pub struct Applied<'a> {
pub updated: Vec<RefUpdate>,
}
impl<'a> Applied<'a> {
impl Applied<'_> {
pub fn append(&mut self, other: &mut Self) {
self.rejected.append(&mut other.rejected);
self.updated.append(&mut other.updated);

View File

@ -19,7 +19,7 @@ pub enum Updated<'a> {
Rejected(Update<'a>),
}
impl<'a> From<RefUpdate> for Updated<'a> {
impl From<RefUpdate> for Updated<'_> {
fn from(up: RefUpdate) -> Self {
Updated::Accepted(up)
}
@ -176,13 +176,11 @@ fn direct<'a>(
no_ff,
}
.into()),
Ancestry::Diverged => {
return Err(error::Update::NonFF {
Ancestry::Diverged => Err(error::Update::NonFF {
name: name.to_owned(),
new: target,
cur: prev,
})
}
}),
}
}
None => {

View File

@ -608,7 +608,7 @@ pub(crate) struct Cached<'a, S> {
state: &'a mut FetchState,
}
impl<'a, S> Cached<'a, S> {
impl<S> Cached<'_, S> {
/// Resolves `refname` to its [`ObjectId`] by first looking at the
/// [`FetchState`] and falling back to the [`Handle::refdb`].
pub fn refname_to_id<'b, N>(
@ -656,7 +656,7 @@ impl<'a, S> Cached<'a, S> {
}
}
impl<'a, S> RemoteRepository for Cached<'a, S> {
impl<S> RemoteRepository for Cached<'_, S> {
fn remote(&self, remote: &RemoteId) -> Result<Remote, storage::refs::Error> {
// N.b. this is unused so we just delegate to the underlying
// repository for a correct implementation.
@ -676,7 +676,7 @@ impl<'a, S> RemoteRepository for Cached<'a, S> {
}
}
impl<'a, S> ValidateRepository for Cached<'a, S> {
impl<S> ValidateRepository for Cached<'_, S> {
// N.b. we don't verify the `rad/id` of each remote since they may
// not have a reference to the COB if they have not interacted
// with it.

View File

@ -108,7 +108,7 @@ pub struct FetchOut {
// FIXME: the delegate pattern will be removed in the near future and
// we should look at the fetch code being used in gix to see how we
// can migrate to the proper form of fetching.
impl<'a> Delegate for &'a mut Fetch {
impl Delegate for &mut Fetch {
fn receive_pack(
&mut self,
input: impl io::BufRead,
@ -134,7 +134,7 @@ impl<'a> Delegate for &'a mut Fetch {
}
}
impl<'a> DelegateBlocking for &'a mut Fetch {
impl DelegateBlocking for &mut Fetch {
fn negotiate(
&mut self,
_refs: &[handshake::Ref],

View File

@ -1,3 +1,8 @@
// N.b. Rust 1.85 introduced some annoying clippy warnings about using `b""`
// syntax in place of `b''`, but in our cases they were u8 and not [u8] so the
// suggestions did not make sense.
#![allow(clippy::byte_char_slices)]
pub mod bounded;
pub mod control;
pub mod deserializer;

View File

@ -101,19 +101,19 @@ impl StreamId {
/// Create a control identifier.
pub fn control(link: Link) -> Self {
let link = if link.is_outbound() { 0 } else { 1 };
Self(VarInt::from((StreamKind::Control as u8) << 1 | link))
Self(VarInt::from(((StreamKind::Control as u8) << 1) | link))
}
/// Create a gossip identifier.
pub fn gossip(link: Link) -> Self {
let link = if link.is_outbound() { 0 } else { 1 };
Self(VarInt::from((StreamKind::Gossip as u8) << 1 | link))
Self(VarInt::from(((StreamKind::Gossip as u8) << 1) | link))
}
/// Create a git identifier.
pub fn git(link: Link) -> Self {
let link = if link.is_outbound() { 0 } else { 1 };
Self(VarInt::from((StreamKind::Git as u8) << 1 | link))
Self(VarInt::from(((StreamKind::Git as u8) << 1) | link))
}
/// Get the nth identifier while preserving the stream type and initiator.

View File

@ -135,11 +135,11 @@ impl Encode for VarInt {
if x < 2u64.pow(6) {
(x as u8).encode(w)
} else if x < 2u64.pow(14) {
(0b01 << 14 | x as u16).encode(w)
((0b01 << 14) | x as u16).encode(w)
} else if x < 2u64.pow(30) {
(0b10 << 30 | x as u32).encode(w)
((0b10 << 30) | x as u32).encode(w)
} else if x < 2u64.pow(62) {
(0b11 << 62 | x).encode(w)
((0b11 << 62) | x).encode(w)
} else {
panic!("VarInt::encode: integer overflow");
}

View File

@ -268,7 +268,7 @@ pub(super) mod pktline {
}
}
impl<'a, R: io::Read> io::Read for Reader<'a, R> {
impl<R: io::Read> io::Read for Reader<'_, R> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.stream.read(buf)
}

View File

@ -72,7 +72,7 @@ impl Iterator for Iter {
}
/// Represents a set of styling options.
#[repr(packed)]
#[repr(C, packed)]
#[derive(Default, Debug, Eq, Ord, PartialOrd, Copy, Clone)]
pub struct Style {
pub(crate) foreground: Color,

View File

@ -83,6 +83,7 @@ impl Editor {
/// Initialize the file with the provided `content`, as long as the file
/// does not already contain anything.
#[allow(clippy::byte_char_slices)]
pub fn initial(self, content: impl AsRef<[u8]>) -> io::Result<Self> {
let content = content.as_ref();
let mut file = fs::OpenOptions::new()

View File

@ -109,7 +109,7 @@ pub trait Element: fmt::Debug + Send + Sync {
}
}
impl<'a> Element for Box<dyn Element + 'a> {
impl Element for Box<dyn Element + '_> {
fn size(&self, parent: Constraint) -> Size {
self.deref().size(parent)
}

View File

@ -18,7 +18,7 @@ impl<'a> HStack<'a> {
}
}
impl<'a> Element for HStack<'a> {
impl Element for HStack<'_> {
fn size(&self, parent: Constraint) -> Size {
let width = self.elems.iter().map(|c| c.columns(parent)).sum();
let height = self.elems.iter().map(|c| c.rows(parent)).max().unwrap_or(0);

View File

@ -25,7 +25,7 @@ enum Row<'a> {
Dividier,
}
impl<'a> Row<'a> {
impl Row<'_> {
fn width(&self, c: Constraint) -> usize {
match self {
Self::Element(e) => e.columns(c),
@ -140,7 +140,7 @@ impl<'a> VStack<'a> {
}
}
impl<'a> Element for VStack<'a> {
impl Element for VStack<'_> {
fn size(&self, parent: Constraint) -> Size {
self.outer(parent)
}

View File

@ -50,7 +50,7 @@ pub struct MigrateProgress<'a> {
pub rows: &'a Progress,
}
impl<'a> MigrateProgress<'a> {
impl MigrateProgress<'_> {
/// If we're done with the migration.
pub fn is_done(&self) -> bool {
self.migration.current() == self.migration.total()

View File

@ -127,7 +127,7 @@ impl<'de> Deserialize<'de> for Reaction {
{
struct ReactionVisitor;
impl<'de> serde::de::Visitor<'de> for ReactionVisitor {
impl serde::de::Visitor<'_> for ReactionVisitor {
type Value = Reaction;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@ -316,7 +316,7 @@ impl std::str::FromStr for Uri {
type Err = String;
fn from_str(s: &str) -> Result<Self, Self::Err> {
if !s.chars().all(|c| c.is_ascii()) {
if !s.is_ascii() {
return Err(s.to_owned());
}
if !s.contains(':') {

View File

@ -867,7 +867,7 @@ pub struct IdentityMut<'a, R> {
store: store::Store<'a, Identity, R>,
}
impl<'a, R> fmt::Debug for IdentityMut<'a, R> {
impl<R> fmt::Debug for IdentityMut<'_, R> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("IdentityMut")
.field("id", &self.id)
@ -876,7 +876,7 @@ impl<'a, R> fmt::Debug for IdentityMut<'a, R> {
}
}
impl<'a, R> IdentityMut<'a, R>
impl<R> IdentityMut<'_, R>
where
R: WriteRepository + cob::Store,
{
@ -971,7 +971,7 @@ where
}
}
impl<'a, R> Deref for IdentityMut<'a, R> {
impl<R> Deref for IdentityMut<'_, R> {
type Target = Identity;
fn deref(&self) -> &Self::Target {

View File

@ -306,7 +306,7 @@ impl Issue {
pub fn replies_to<'a>(
&'a self,
to: &'a CommentId,
) -> impl Iterator<Item = (&CommentId, &thread::Comment)> {
) -> impl Iterator<Item = (&'a CommentId, &'a thread::Comment)> {
self.thread.replies(to)
}
@ -576,7 +576,7 @@ pub struct IssueMut<'a, 'g, R, C> {
cache: &'g mut C,
}
impl<'a, 'g, R, C> std::fmt::Debug for IssueMut<'a, 'g, R, C> {
impl<R, C> std::fmt::Debug for IssueMut<'_, '_, R, C> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("IssueMut")
.field("id", &self.id)
@ -585,7 +585,7 @@ impl<'a, 'g, R, C> std::fmt::Debug for IssueMut<'a, 'g, R, C> {
}
}
impl<'a, 'g, R, C> IssueMut<'a, 'g, R, C>
impl<R, C> IssueMut<'_, '_, R, C>
where
R: WriteRepository + cob::Store,
C: cob::cache::Update<Issue>,
@ -719,7 +719,7 @@ where
}
}
impl<'a, 'g, R, C> Deref for IssueMut<'a, 'g, R, C> {
impl<R, C> Deref for IssueMut<'_, '_, R, C> {
type Target = Issue;
fn deref(&self) -> &Self::Target {
@ -739,7 +739,7 @@ impl<'a, R> Deref for Issues<'a, R> {
}
}
impl<'a, R> HasRepoId for Issues<'a, R>
impl<R> HasRepoId for Issues<'_, R>
where
R: ReadRepository,
{

View File

@ -364,7 +364,7 @@ pub struct NoCacheIter<'a> {
inner: Box<dyn Iterator<Item = Result<(IssueId, Issue), super::Error>> + 'a>,
}
impl<'a> Iterator for NoCacheIter<'a> {
impl Iterator for NoCacheIter<'_> {
type Item = Result<(IssueId, Issue), super::Error>;
fn next(&mut self) -> Option<Self::Item> {
@ -372,12 +372,15 @@ impl<'a> Iterator for NoCacheIter<'a> {
}
}
impl<'a, R> Issues for Cache<super::Issues<'a, R>, cache::NoCache>
impl<R> Issues for Cache<super::Issues<'_, R>, cache::NoCache>
where
R: ReadRepository + cob::Store,
{
type Error = super::Error;
type Iter<'b> = NoCacheIter<'b> where Self: 'b;
type Iter<'b>
= NoCacheIter<'b>
where
Self: 'b;
fn get(&self, id: &IssueId) -> Result<Option<Issue>, Self::Error> {
self.store.get(id).map_err(super::Error::from)
@ -406,7 +409,7 @@ where
}
fn counts(&self) -> Result<IssueCounts, Self::Error> {
self.store.counts().map_err(super::Error::from)
self.store.counts()
}
}
@ -430,7 +433,7 @@ pub struct IssuesIter<'a> {
inner: sql::CursorWithOwnership<'a>,
}
impl<'a> IssuesIter<'a> {
impl IssuesIter<'_> {
fn parse_row(row: sql::Row) -> Result<(IssueId, Issue), Error> {
let id = IssueId::from_str(row.read::<&str, _>("id"))?;
let issue = serde_json::from_str::<Issue>(row.read::<&str, _>("issue"))?;
@ -438,7 +441,7 @@ impl<'a> IssuesIter<'a> {
}
}
impl<'a> Iterator for IssuesIter<'a> {
impl Iterator for IssuesIter<'_> {
type Item = Result<(IssueId, Issue), Error>;
fn next(&mut self) -> Option<Self::Item> {
@ -452,7 +455,10 @@ where
R: HasRepoId,
{
type Error = Error;
type Iter<'b> = IssuesIter<'b> where Self: 'b;
type Iter<'b>
= IssuesIter<'b>
where
Self: 'b;
fn get(&self, id: &IssueId) -> Result<Option<Issue>, Self::Error> {
query::get(&self.cache.db, &self.rid(), id)
@ -476,7 +482,10 @@ where
R: HasRepoId,
{
type Error = Error;
type Iter<'b> = IssuesIter<'b> where Self: 'b;
type Iter<'b>
= IssuesIter<'b>
where
Self: 'b;
fn get(&self, id: &IssueId) -> Result<Option<Issue>, Self::Error> {
query::get(&self.cache.db, &self.rid(), id)

View File

@ -300,7 +300,7 @@ impl<'a, 'g, R> From<JobMut<'a, 'g, R>> for (JobId, Job) {
}
}
impl<'a, 'g, R> std::fmt::Debug for JobMut<'a, 'g, R> {
impl<R> std::fmt::Debug for JobMut<'_, '_, R> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("JobMut")
.field("id", &self.id)
@ -309,7 +309,7 @@ impl<'a, 'g, R> std::fmt::Debug for JobMut<'a, 'g, R> {
}
}
impl<'a, 'g, R> JobMut<'a, 'g, R>
impl<R> JobMut<'_, '_, R>
where
R: WriteRepository + cob::Store,
{
@ -365,7 +365,7 @@ where
}
}
impl<'a, 'g, R> Deref for JobMut<'a, 'g, R> {
impl<R> Deref for JobMut<'_, '_, R> {
type Target = Job;
fn deref(&self) -> &Self::Target {

View File

@ -332,7 +332,7 @@ pub struct Merged<'a, R> {
stored: &'a R,
}
impl<'a, R: WriteRepository> Merged<'a, R> {
impl<R: WriteRepository> Merged<'_, R> {
/// Cleanup after merging a patch.
///
/// This removes Git refs relating to the patch, both in the working copy,
@ -521,7 +521,7 @@ impl Patch {
pub fn revisions_by<'a>(
&'a self,
author: &'a PublicKey,
) -> impl DoubleEndedIterator<Item = (RevisionId, &Revision)> {
) -> impl DoubleEndedIterator<Item = (RevisionId, &'a Revision)> {
self.revisions()
.filter(move |(_, r)| (r.author.public_key() == author))
}
@ -569,7 +569,7 @@ impl Patch {
/// Get the commit range of this patch.
pub fn range(&self) -> Result<(git::Oid, git::Oid), git::ext::Error> {
return Ok((*self.base(), *self.head()));
Ok((*self.base(), *self.head()))
}
/// Index of latest revision in the revisions list.
@ -596,7 +596,7 @@ impl Patch {
}
/// Latest revision by the given author.
pub fn latest_by<'a>(&'a self, author: &'a PublicKey) -> Option<(RevisionId, &Revision)> {
pub fn latest_by<'a>(&'a self, author: &'a PublicKey) -> Option<(RevisionId, &'a Revision)> {
self.revisions_by(author).next_back()
}
@ -2348,7 +2348,7 @@ where
}
}
impl<'a, 'g, R, C> Deref for PatchMut<'a, 'g, R, C> {
impl<R, C> Deref for PatchMut<'_, '_, R, C> {
type Target = Patch;
fn deref(&self) -> &Self::Target {
@ -2396,7 +2396,7 @@ impl<'a, R> Deref for Patches<'a, R> {
}
}
impl<'a, R> HasRepoId for Patches<'a, R>
impl<R> HasRepoId for Patches<'_, R>
where
R: ReadRepository,
{
@ -2481,7 +2481,7 @@ where
pub fn proposed_by<'b>(
&'b self,
who: &'b Did,
) -> Result<impl Iterator<Item = (PatchId, Patch)> + '_, Error> {
) -> Result<impl Iterator<Item = (PatchId, Patch)> + 'b, Error> {
Ok(self
.proposed()?
.filter(move |(_, p)| p.author().id() == who))

View File

@ -425,7 +425,7 @@ pub struct PatchesIter<'a> {
inner: sql::CursorWithOwnership<'a>,
}
impl<'a> PatchesIter<'a> {
impl PatchesIter<'_> {
fn parse_row(row: sql::Row) -> Result<(PatchId, Patch), Error> {
let id = PatchId::from_str(row.read::<&str, _>("id"))?;
let patch = serde_json::from_str::<Patch>(row.read::<&str, _>("patch"))
@ -434,7 +434,7 @@ impl<'a> PatchesIter<'a> {
}
}
impl<'a> Iterator for PatchesIter<'a> {
impl Iterator for PatchesIter<'_> {
type Item = Result<(PatchId, Patch), Error>;
fn next(&mut self) -> Option<Self::Item> {
@ -448,7 +448,8 @@ where
R: HasRepoId,
{
type Error = Error;
type Iter<'b> = PatchesIter<'b>
type Iter<'b>
= PatchesIter<'b>
where
Self: 'b;
@ -477,7 +478,7 @@ pub struct NoCacheIter<'a> {
inner: Box<dyn Iterator<Item = Result<(PatchId, Patch), super::Error>> + 'a>,
}
impl<'a> Iterator for NoCacheIter<'a> {
impl Iterator for NoCacheIter<'_> {
type Item = Result<(PatchId, Patch), super::Error>;
fn next(&mut self) -> Option<Self::Item> {
@ -485,12 +486,15 @@ impl<'a> Iterator for NoCacheIter<'a> {
}
}
impl<'a, R> Patches for Cache<super::Patches<'a, R>, cache::NoCache>
impl<R> Patches for Cache<super::Patches<'_, R>, cache::NoCache>
where
R: ReadRepository + cob::Store,
{
type Error = super::Error;
type Iter<'b> = NoCacheIter<'b> where Self: 'b;
type Iter<'b>
= NoCacheIter<'b>
where
Self: 'b;
fn get(&self, id: &PatchId) -> Result<Option<Patch>, Self::Error> {
self.store.get(id).map_err(super::Error::from)
@ -536,7 +540,8 @@ where
R: HasRepoId,
{
type Error = Error;
type Iter<'b> = PatchesIter<'b>
type Iter<'b>
= PatchesIter<'b>
where
Self: 'b;

View File

@ -111,7 +111,7 @@ pub struct Store<'a, T, R> {
witness: PhantomData<T>,
}
impl<'a, T, R> AsRef<R> for Store<'a, T, R> {
impl<T, R> AsRef<R> for Store<'_, T, R> {
fn as_ref(&self) -> &R {
self.repo
}
@ -140,7 +140,7 @@ where
}
}
impl<'a, T, R> Store<'a, T, R>
impl<T, R> Store<'_, T, R>
where
R: ReadRepository + SignRepository + cob::Store,
T: Cob + cob::Evaluate<R>,

View File

@ -387,7 +387,7 @@ impl<L> Thread<Comment<L>> {
pub fn replies<'a>(
&'a self,
to: &'a CommentId,
) -> impl Iterator<Item = (&CommentId, &Comment<L>)> {
) -> impl Iterator<Item = (&'a CommentId, &'a Comment<L>)> {
self.comments().filter_map(move |(id, c)| {
if let Some(reply_to) = c.reply_to {
if &reply_to == to {

View File

@ -200,7 +200,7 @@ impl Canonical {
let (mut longest, _) = candidates
.pop_first()
.ok_or_else(|| QuorumError::NoCandidates(NoCandidates { threshold }))?;
.ok_or(QuorumError::NoCandidates(NoCandidates { threshold }))?;
// Now that all scores are calculated, figure out what is the longest branch
// that passes the threshold. In case of divergence, return an error.

View File

@ -757,7 +757,7 @@ impl Seeds {
/// Check if a seed is connected.
pub fn is_connected(&self, nid: &NodeId) -> bool {
self.0.get(nid).map_or(false, |s| s.is_connected())
self.0.get(nid).is_some_and(|s| s.is_connected())
}
/// Return a new seeds object with the given RNG.
@ -1197,14 +1197,12 @@ impl Handle for Node {
self.call::<NodeId>(Command::NodeId, DEFAULT_TIMEOUT)?
.next()
.ok_or(Error::EmptyResponse)?
.map_err(Error::from)
}
fn listen_addrs(&self) -> Result<Vec<net::SocketAddr>, Error> {
self.call::<Vec<net::SocketAddr>>(Command::ListenAddrs, DEFAULT_TIMEOUT)?
.next()
.ok_or(Error::EmptyResponse)?
.map_err(Error::from)
}
fn is_running(&self) -> bool {
@ -1222,7 +1220,6 @@ impl Handle for Node {
self.call::<config::Config>(Command::Config, DEFAULT_TIMEOUT)?
.next()
.ok_or(Error::EmptyResponse)?
.map_err(Error::from)
}
fn connect(

View File

@ -428,7 +428,7 @@ pub struct NodeAliasIter<'a> {
inner: sql::CursorWithOwnership<'a>,
}
impl<'a> NodeAliasIter<'a> {
impl NodeAliasIter<'_> {
fn parse_row(row: sql::Row) -> Result<(NodeId, Alias), Error> {
let nid = row.try_read::<NodeId, _>("id")?;
let alias = row.try_read::<&str, _>("alias")?.parse()?;
@ -436,7 +436,7 @@ impl<'a> NodeAliasIter<'a> {
}
}
impl<'a> Iterator for NodeAliasIter<'a> {
impl Iterator for NodeAliasIter<'_> {
type Item = Result<(NodeId, Alias), Error>;
fn next(&mut self) -> Option<Self::Item> {
@ -446,7 +446,8 @@ impl<'a> Iterator for NodeAliasIter<'a> {
}
impl StoreExt for Database {
type NodeAlias<'a> = NodeAliasIter<'a>
type NodeAlias<'a>
= NodeAliasIter<'a>
where
Self: 'a;

View File

@ -76,7 +76,7 @@ pub enum NotificationKindError {
RefFormat(#[from] radicle_git_ext::ref_format::Error),
}
impl<'a> TryFrom<Qualified<'a>> for NotificationKind {
impl TryFrom<Qualified<'_>> for NotificationKind {
type Error = NotificationKindError;
fn try_from(value: Qualified) -> Result<Self, Self::Error> {

View File

@ -328,7 +328,7 @@ pub struct FollowPolicies<'a> {
inner: sql::CursorWithOwnership<'a>,
}
impl<'a> Iterator for FollowPolicies<'a> {
impl Iterator for FollowPolicies<'_> {
type Item = FollowPolicy;
fn next(&mut self) -> Option<Self::Item> {
@ -355,7 +355,7 @@ pub struct SeedPolicies<'a> {
inner: sql::CursorWithOwnership<'a>,
}
impl<'a> Iterator for SeedPolicies<'a> {
impl Iterator for SeedPolicies<'_> {
type Item = SeedPolicy;
fn next(&mut self) -> Option<Self::Item> {
@ -376,7 +376,7 @@ pub struct NodeAliasIter<'a> {
inner: sql::CursorWithOwnership<'a>,
}
impl<'a> NodeAliasIter<'a> {
impl NodeAliasIter<'_> {
fn parse_row(row: sql::Row) -> Result<(NodeId, Alias), Error> {
let nid = row.try_read::<NodeId, _>("id")?;
let alias = row.try_read::<Alias, _>("alias")?;
@ -384,7 +384,7 @@ impl<'a> NodeAliasIter<'a> {
}
}
impl<'a> Iterator for NodeAliasIter<'a> {
impl Iterator for NodeAliasIter<'_> {
type Item = Result<(NodeId, Alias), Error>;
fn next(&mut self) -> Option<Self::Item> {

View File

@ -52,7 +52,7 @@ pub struct Ref {
pub namespace: Option<RemoteId>,
}
impl<'a> TryFrom<git2::Reference<'a>> for Ref {
impl TryFrom<git2::Reference<'_>> for Ref {
type Error = RefError;
fn try_from(r: git2::Reference) -> Result<Self, Self::Error> {

View File

@ -170,7 +170,7 @@ impl cob::object::Storage for Repository {
.backend
.find_reference(git::refs::storage::cob(identifier, typename, object_id).as_str())?;
reference.delete().map_err(Self::RemoveError::from)
reference.delete()
}
}
@ -190,9 +190,9 @@ impl<'a, R> DraftStore<'a, R> {
}
}
impl<'a, R: storage::WriteRepository> cob::Store for DraftStore<'a, R> {}
impl<R: storage::WriteRepository> cob::Store for DraftStore<'_, R> {}
impl<'a, R: storage::WriteRepository> change::Storage for DraftStore<'a, R> {
impl<R: storage::WriteRepository> change::Storage for DraftStore<'_, R> {
type StoreError = <git2::Repository as change::Storage>::StoreError;
type LoadError = <git2::Repository as change::Storage>::LoadError;
@ -222,7 +222,7 @@ impl<'a, R: storage::WriteRepository> change::Storage for DraftStore<'a, R> {
}
}
impl<'a, R: storage::ReadRepository> SignRepository for DraftStore<'a, R> {
impl<R: storage::ReadRepository> SignRepository for DraftStore<'_, R> {
fn sign_refs<G: crypto::Signer>(
&self,
signer: &G,
@ -235,7 +235,7 @@ impl<'a, R: storage::ReadRepository> SignRepository for DraftStore<'a, R> {
}
}
impl<'a, R: storage::RemoteRepository> RemoteRepository for DraftStore<'a, R> {
impl<R: storage::RemoteRepository> RemoteRepository for DraftStore<'_, R> {
fn remote(&self, id: &RemoteId) -> Result<Remote<Verified>, storage::refs::Error> {
self.repo.remote(id)
}
@ -249,13 +249,13 @@ impl<'a, R: storage::RemoteRepository> RemoteRepository for DraftStore<'a, R> {
}
}
impl<'a, R: storage::ValidateRepository> ValidateRepository for DraftStore<'a, R> {
impl<R: storage::ValidateRepository> ValidateRepository for DraftStore<'_, R> {
fn validate_remote(&self, remote: &Remote<Verified>) -> Result<Validations, Error> {
self.repo.validate_remote(remote)
}
}
impl<'a, R: storage::ReadRepository> ReadRepository for DraftStore<'a, R> {
impl<R: storage::ReadRepository> ReadRepository for DraftStore<'_, R> {
fn id(&self) -> identity::RepoId {
self.repo.id()
}
@ -364,7 +364,7 @@ impl<'a, R: storage::ReadRepository> ReadRepository for DraftStore<'a, R> {
}
}
impl<'a, R: storage::WriteRepository> cob::object::Storage for DraftStore<'a, R> {
impl<R: storage::WriteRepository> cob::object::Storage for DraftStore<'_, R> {
type ObjectsError = ObjectsError;
type TypesError = git::ext::Error;
type UpdateError = git2::Error;

View File

@ -10,7 +10,7 @@ pub struct Version<'a> {
pub timestamp: &'a str,
}
impl<'a> Version<'a> {
impl Version<'_> {
/// Write program version as string.
/// Adjust with caution, third party applications parse the string for version info.
pub fn write(&self, mut w: impl std::io::Write) -> Result<(), io::Error> {

View File

@ -1,4 +1,4 @@
[toolchain]
channel = "1.80"
channel = "1.85"
profile = "default"
components = [ "rust-src" ]