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

View File

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

View File

@ -490,7 +490,7 @@ pub fn fetch(
if settings if settings
.seeds .seeds
.iter() .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); 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 { fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner &mut self.inner
} }

View File

@ -16,7 +16,7 @@ pub struct SetupRemote<'a> {
pub repo: &'a git::Repository, pub repo: &'a git::Repository,
} }
impl<'a> SetupRemote<'a> { impl SetupRemote<'_> {
/// Run the setup for the given peer. /// Run the setup for the given peer.
pub fn run( pub fn run(
&self, &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 { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let nid = self.profile.id(); let nid = self.profile.id();
let alias = self.profile.aliases().alias(nid); let alias = self.profile.aliases().alias(nid);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -101,19 +101,19 @@ impl StreamId {
/// Create a control identifier. /// Create a control identifier.
pub fn control(link: Link) -> Self { pub fn control(link: Link) -> Self {
let link = if link.is_outbound() { 0 } else { 1 }; 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. /// Create a gossip identifier.
pub fn gossip(link: Link) -> Self { pub fn gossip(link: Link) -> Self {
let link = if link.is_outbound() { 0 } else { 1 }; 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. /// Create a git identifier.
pub fn git(link: Link) -> Self { pub fn git(link: Link) -> Self {
let link = if link.is_outbound() { 0 } else { 1 }; 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. /// 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) { if x < 2u64.pow(6) {
(x as u8).encode(w) (x as u8).encode(w)
} else if x < 2u64.pow(14) { } 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) { } 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) { } else if x < 2u64.pow(62) {
(0b11 << 62 | x).encode(w) ((0b11 << 62) | x).encode(w)
} else { } else {
panic!("VarInt::encode: integer overflow"); 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> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.stream.read(buf) self.stream.read(buf)
} }

View File

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

View File

@ -83,6 +83,7 @@ impl Editor {
/// Initialize the file with the provided `content`, as long as the file /// Initialize the file with the provided `content`, as long as the file
/// does not already contain anything. /// does not already contain anything.
#[allow(clippy::byte_char_slices)]
pub fn initial(self, content: impl AsRef<[u8]>) -> io::Result<Self> { pub fn initial(self, content: impl AsRef<[u8]>) -> io::Result<Self> {
let content = content.as_ref(); let content = content.as_ref();
let mut file = fs::OpenOptions::new() 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 { fn size(&self, parent: Constraint) -> Size {
self.deref().size(parent) 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 { fn size(&self, parent: Constraint) -> Size {
let width = self.elems.iter().map(|c| c.columns(parent)).sum(); 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); let height = self.elems.iter().map(|c| c.rows(parent)).max().unwrap_or(0);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -364,7 +364,7 @@ pub struct NoCacheIter<'a> {
inner: Box<dyn Iterator<Item = Result<(IssueId, Issue), super::Error>> + '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>; type Item = Result<(IssueId, Issue), super::Error>;
fn next(&mut self) -> Option<Self::Item> { 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 where
R: ReadRepository + cob::Store, R: ReadRepository + cob::Store,
{ {
type Error = super::Error; 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> { fn get(&self, id: &IssueId) -> Result<Option<Issue>, Self::Error> {
self.store.get(id).map_err(super::Error::from) self.store.get(id).map_err(super::Error::from)
@ -406,7 +409,7 @@ where
} }
fn counts(&self) -> Result<IssueCounts, Self::Error> { 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>, inner: sql::CursorWithOwnership<'a>,
} }
impl<'a> IssuesIter<'a> { impl IssuesIter<'_> {
fn parse_row(row: sql::Row) -> Result<(IssueId, Issue), Error> { fn parse_row(row: sql::Row) -> Result<(IssueId, Issue), Error> {
let id = IssueId::from_str(row.read::<&str, _>("id"))?; let id = IssueId::from_str(row.read::<&str, _>("id"))?;
let issue = serde_json::from_str::<Issue>(row.read::<&str, _>("issue"))?; 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>; type Item = Result<(IssueId, Issue), Error>;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
@ -452,7 +455,10 @@ where
R: HasRepoId, R: HasRepoId,
{ {
type Error = Error; 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> { fn get(&self, id: &IssueId) -> Result<Option<Issue>, Self::Error> {
query::get(&self.cache.db, &self.rid(), id) query::get(&self.cache.db, &self.rid(), id)
@ -476,7 +482,10 @@ where
R: HasRepoId, R: HasRepoId,
{ {
type Error = Error; 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> { fn get(&self, id: &IssueId) -> Result<Option<Issue>, Self::Error> {
query::get(&self.cache.db, &self.rid(), id) 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 { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("JobMut") f.debug_struct("JobMut")
.field("id", &self.id) .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 where
R: WriteRepository + cob::Store, 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; type Target = Job;
fn deref(&self) -> &Self::Target { fn deref(&self) -> &Self::Target {

View File

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

View File

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

View File

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

View File

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

View File

@ -200,7 +200,7 @@ impl Canonical {
let (mut longest, _) = candidates let (mut longest, _) = candidates
.pop_first() .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 // Now that all scores are calculated, figure out what is the longest branch
// that passes the threshold. In case of divergence, return an error. // 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. /// Check if a seed is connected.
pub fn is_connected(&self, nid: &NodeId) -> bool { 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. /// Return a new seeds object with the given RNG.
@ -1197,14 +1197,12 @@ impl Handle for Node {
self.call::<NodeId>(Command::NodeId, DEFAULT_TIMEOUT)? self.call::<NodeId>(Command::NodeId, DEFAULT_TIMEOUT)?
.next() .next()
.ok_or(Error::EmptyResponse)? .ok_or(Error::EmptyResponse)?
.map_err(Error::from)
} }
fn listen_addrs(&self) -> Result<Vec<net::SocketAddr>, Error> { fn listen_addrs(&self) -> Result<Vec<net::SocketAddr>, Error> {
self.call::<Vec<net::SocketAddr>>(Command::ListenAddrs, DEFAULT_TIMEOUT)? self.call::<Vec<net::SocketAddr>>(Command::ListenAddrs, DEFAULT_TIMEOUT)?
.next() .next()
.ok_or(Error::EmptyResponse)? .ok_or(Error::EmptyResponse)?
.map_err(Error::from)
} }
fn is_running(&self) -> bool { fn is_running(&self) -> bool {
@ -1222,7 +1220,6 @@ impl Handle for Node {
self.call::<config::Config>(Command::Config, DEFAULT_TIMEOUT)? self.call::<config::Config>(Command::Config, DEFAULT_TIMEOUT)?
.next() .next()
.ok_or(Error::EmptyResponse)? .ok_or(Error::EmptyResponse)?
.map_err(Error::from)
} }
fn connect( fn connect(

View File

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

View File

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

View File

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

View File

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

View File

@ -170,7 +170,7 @@ impl cob::object::Storage for Repository {
.backend .backend
.find_reference(git::refs::storage::cob(identifier, typename, object_id).as_str())?; .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 StoreError = <git2::Repository as change::Storage>::StoreError;
type LoadError = <git2::Repository as change::Storage>::LoadError; 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>( fn sign_refs<G: crypto::Signer>(
&self, &self,
signer: &G, 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> { fn remote(&self, id: &RemoteId) -> Result<Remote<Verified>, storage::refs::Error> {
self.repo.remote(id) 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> { fn validate_remote(&self, remote: &Remote<Verified>) -> Result<Validations, Error> {
self.repo.validate_remote(remote) 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 { fn id(&self) -> identity::RepoId {
self.repo.id() 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 ObjectsError = ObjectsError;
type TypesError = git::ext::Error; type TypesError = git::ext::Error;
type UpdateError = git2::Error; type UpdateError = git2::Error;

View File

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

View File

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