Update `rust-toolchain` to 1.80

Fix new clippy warnings.
This commit is contained in:
cloudhead 2024-08-06 14:25:03 +02:00
parent 0e08452323
commit c6a8a00055
No known key found for this signature in database
17 changed files with 50 additions and 51 deletions

View File

@ -211,7 +211,7 @@ impl TestFormula {
let results = escargot::CargoBuild::new()
.package(package)
.bin(binary)
.manifest_path(&manifest.join("Cargo.toml"))
.manifest_path(manifest.join("Cargo.toml"))
.target_dir(&target_dir)
.exec()
.unwrap();

View File

@ -194,8 +194,8 @@ impl ReviewItem {
fn paths(&self) -> (Option<(&Path, Oid)>, Option<(&Path, Oid)>) {
match self {
Self::FileAdded { path, new, .. } => (None, Some((&path, new.oid))),
Self::FileDeleted { path, old, .. } => (Some((&path, old.oid)), None),
Self::FileAdded { path, new, .. } => (None, Some((path, new.oid))),
Self::FileDeleted { path, old, .. } => (Some((path, old.oid)), None),
Self::FileMoved { moved } => (
Some((&moved.old_path, moved.old.oid)),
Some((&moved.new_path, moved.new.oid)),
@ -797,7 +797,7 @@ impl<'a, G: Signer> ReviewBuilder<'a, G> {
fn prompt(
&self,
mut input: impl io::BufRead,
mut output: &mut impl PromptWriter,
output: &mut impl PromptWriter,
progress: impl fmt::Display,
) -> Option<ReviewAction> {
if let Some(v) = self.verdict {
@ -808,7 +808,7 @@ impl<'a, G: Signer> ReviewBuilder<'a, G> {
} else if output.is_terminal() {
let prompt = term::format::secondary("Accept this hunk? [y,n,c,j,k,q,?]").bold();
ReviewAction::prompt(&mut input, &mut output, format!("{progress} {prompt}"))
ReviewAction::prompt(&mut input, output, format!("{progress} {prompt}"))
.unwrap_or(Some(ReviewAction::Help))
} else {
Some(ReviewAction::Ignore)

View File

@ -371,7 +371,7 @@ impl unified_diff::Encode for FileDDiff {
}
/// A diff of a diff.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Default)]
pub struct DDiff {
files: Vec<FileDDiff>,
}

View File

@ -299,7 +299,6 @@ impl Highlighter {
)
.expect("Highlighter::config: highlight configuration must be valid")
})),
#[cfg(feature = "tree-sitter-ruby")]
"ruby" => Some(self.configs.entry(language).or_insert_with(|| {
ts::HighlightConfiguration::new(
tree_sitter_ruby::language(),

View File

@ -856,7 +856,7 @@ fn rad_node() {
test(
"examples/rad-init-sync-not-connected.md",
&working.path().join("alice"),
working.path().join("alice"),
Some(&alice.home),
[],
)
@ -1632,7 +1632,7 @@ fn rad_init_sync_not_connected() {
test(
"examples/rad-init-sync-not-connected.md",
&working.path().join("alice"),
working.path().join("alice"),
Some(&alice.home),
[],
)
@ -1664,7 +1664,7 @@ fn rad_init_sync_preferred() {
// Bob initializes a repo after her node has started, and after bob has connected to it.
test(
"examples/rad-init-sync-preferred.md",
&working.join("bob"),
working.join("bob"),
Some(&bob.home),
[],
)
@ -1696,7 +1696,7 @@ fn rad_init_sync_timeout() {
// Bob initializes a repo after her node has started, and after bob has connected to it.
test(
"examples/rad-init-sync-timeout.md",
&working.join("bob"),
working.join("bob"),
Some(&bob.home),
[],
)
@ -1720,7 +1720,7 @@ fn rad_init_sync_and_clone() {
// Alice initializes a repo after her node has started, and after bob has connected to it.
test(
"examples/rad-init-sync.md",
&working.join("alice"),
working.join("alice"),
Some(&alice.home),
[],
)
@ -1754,7 +1754,7 @@ fn rad_fetch() {
// Alice initializes a repo after her node has started, and after bob has connected to it.
test(
"examples/rad-init-sync.md",
&working.join("alice"),
working.join("alice"),
Some(&alice.home),
[],
)
@ -1788,7 +1788,7 @@ fn rad_fork() {
// Alice initializes a repo after her node has started, and after bob has connected to it.
test(
"examples/rad-init-sync.md",
&working.join("alice"),
working.join("alice"),
Some(&alice.home),
[],
)
@ -2865,28 +2865,28 @@ fn git_push_and_fetch() {
test(
"examples/rad-clone.md",
&working.join("bob"),
working.join("bob"),
Some(&bob.home),
[],
)
.unwrap();
test(
"examples/git/git-push.md",
&working.join("alice"),
working.join("alice"),
Some(&alice.home),
[],
)
.unwrap();
test(
"examples/git/git-fetch.md",
&working.join("bob"),
working.join("bob"),
Some(&bob.home),
[],
)
.unwrap();
test(
"examples/git/git-push-delete.md",
&working.join("alice"),
working.join("alice"),
Some(&alice.home),
[],
)
@ -2917,7 +2917,7 @@ fn git_tag() {
test(
"examples/rad-clone.md",
&working.join("bob"),
working.join("bob"),
Some(&bob.home),
[],
)
@ -2949,7 +2949,7 @@ fn rad_workflow() {
test(
"examples/workflow/1-new-project.md",
&working.join("alice"),
working.join("alice"),
Some(&alice.home),
[],
)
@ -2962,7 +2962,7 @@ fn rad_workflow() {
test(
"examples/workflow/2-cloning.md",
&working.join("bob"),
working.join("bob"),
Some(&bob.home),
[],
)
@ -2970,7 +2970,7 @@ fn rad_workflow() {
test(
"examples/workflow/3-issues.md",
&working.join("bob").join("heartwood"),
working.join("bob").join("heartwood"),
Some(&bob.home),
[],
)
@ -2978,7 +2978,7 @@ fn rad_workflow() {
test(
"examples/workflow/4-patching-contributor.md",
&working.join("bob").join("heartwood"),
working.join("bob").join("heartwood"),
Some(&bob.home),
[],
)
@ -2986,7 +2986,7 @@ fn rad_workflow() {
test(
"examples/workflow/5-patching-maintainer.md",
&working.join("alice"),
working.join("alice"),
Some(&alice.home),
[],
)
@ -2994,7 +2994,7 @@ fn rad_workflow() {
test(
"examples/workflow/6-pulling-contributor.md",
&working.join("bob").join("heartwood"),
working.join("bob").join("heartwood"),
Some(&bob.home),
[],
)

View File

@ -364,7 +364,7 @@ fn write_manifest(
// Insert each COB entry.
for (ix, op) in contents.iter().enumerate() {
let oid = repo.blob(op.as_ref())?;
root.insert(&ix.to_string(), oid, git2::FileMode::Blob.into())?;
root.insert(ix.to_string(), oid, git2::FileMode::Blob.into())?;
}
// Insert each embed in a tree at `/embeds`.

View File

@ -9,8 +9,7 @@
//!
//! The basic types that are found in `radicle-cob` are:
//! * [`CollaborativeObject`] -- the computed object itself.
//! * [`ObjectId`] -- the content-address for a single collaborative
//! object.
//! * [`ObjectId`] -- the content-address for a single collaborative object.
//! * [`TypeName`] -- the name for a collection of collaborative objects.
//! * [`History`] -- the traversable history of the changes made to
//! a single collaborative object.

View File

@ -94,11 +94,11 @@ impl TryFrom<&str> for Lamport {
impl Bounded for Lamport {
fn min_value() -> Self {
Self::from(u64::min_value())
Self::from(u64::MIN)
}
fn max_value() -> Self {
Self::from(u64::max_value())
Self::from(u64::MAX)
}
}
@ -147,13 +147,13 @@ impl std::ops::Add<u64> for Physical {
impl Bounded for Physical {
fn min_value() -> Self {
Self {
seconds: u64::min_value(),
seconds: u64::MIN,
}
}
fn max_value() -> Self {
Self {
seconds: u64::max_value(),
seconds: u64::MAX,
}
}
}

View File

@ -155,6 +155,7 @@ pub(crate) trait ProtocolStage {
#[derive(Debug)]
pub struct CanonicalId {
pub remote: PublicKey,
#[allow(dead_code)]
pub limit: u64,
}
@ -231,6 +232,7 @@ pub struct SpecialRefs {
/// The set of nodes that should be blocked from fetching.
pub blocked: BlockList,
/// The node that is being fetched from.
#[allow(dead_code)]
pub remote: PublicKey,
/// The set of nodes to be fetched.
pub followed: policy::Allowed,
@ -240,6 +242,7 @@ pub struct SpecialRefs {
/// The threshold of delegates that needs to be fetched.
pub threshold: usize,
/// The data limit for this stage of fetching.
#[allow(dead_code)]
pub limit: u64,
}
@ -311,6 +314,7 @@ pub struct SigrefsAt {
/// The set of nodes that should be blocked from fetching.
pub blocked: BlockList,
/// The node that is being fetched from.
#[allow(dead_code)]
pub remote: PublicKey,
/// The set of remotes and the newly announced `Oid` for their
/// `rad/sigrefs`.
@ -319,6 +323,7 @@ pub struct SigrefsAt {
/// removed in the case of a `pull`.
pub delegates: BTreeSet<PublicKey>,
/// The data limit for this stage of fetching.
#[allow(dead_code)]
pub limit: u64,
}
@ -400,11 +405,13 @@ impl ProtocolStage for SigrefsAt {
#[derive(Debug)]
pub struct DataRefs {
/// The node that is being fetched from.
#[allow(dead_code)]
pub remote: PublicKey,
/// The set of signed references from each remote that was
/// fetched.
pub remotes: sigrefs::RemoteRefs,
/// The data limit for this stage of fetching.
#[allow(dead_code)]
pub limit: u64,
}

View File

@ -17,6 +17,7 @@ use super::{agent_name, indicate_end_of_interaction, Connection};
/// See [`run`].
pub struct Config {
/// The repository name, i.e. `/<rid>`.
#[allow(dead_code)]
pub repo: BString,
/// Extra parameters to pass to the ls-refs process.
pub extra_params: Vec<(String, Option<String>)>,

View File

@ -113,7 +113,7 @@ impl Runtime {
/// Initialize the runtime.
///
/// This function spawns threads.
pub fn init<G: Signer + Ecdh + 'static>(
pub fn init<G>(
home: Home,
config: service::Config,
listen: Vec<net::SocketAddr>,
@ -121,7 +121,7 @@ impl Runtime {
signer: G,
) -> Result<Runtime, Error>
where
G: Ecdh<Pk = NodeId> + Clone,
G: Signer + Ecdh<Pk = NodeId> + Clone + 'static,
{
let id = *signer.public_key();
let alias = config.alias.clone();

View File

@ -21,16 +21,6 @@ pub const REF_REMOTE_LIMIT: usize = 1024;
/// Maximum number of inventory which can be announced to other nodes.
pub const INVENTORY_LIMIT: usize = 2973;
#[derive(Debug, Clone, PartialEq, Eq)]
// TODO: We should check the length and charset when deserializing.
pub struct Hostname(String);
impl fmt::Display for Hostname {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Subscribe {
/// Subscribe to events matching this filter.

View File

@ -461,7 +461,7 @@ impl<S: WriteStorage + 'static, G: Signer> Simulation<S, G> {
}
// If the other end has disconnected the sender with some latency, there may not be
// a connection remaining to use.
if self.connections.get(&(node, receiver)).is_none() {
if !self.connections.contains(&(node, receiver)) {
return;
}
let sender = node;

View File

@ -280,7 +280,9 @@ pub(super) mod pktline {
#[derive(Debug)]
pub struct GitRequest {
pub repo: RepoId,
#[allow(dead_code)]
pub path: String,
#[allow(dead_code)]
pub host: Option<(String, Option<u16>)>,
pub extra: Vec<(String, Option<String>)>,
}

View File

@ -717,9 +717,9 @@ pub mod url {
}
}
impl ToString for File {
fn to_string(&self) -> String {
format!("file://{}", self.path.display())
impl std::fmt::Display for File {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "file://{}", self.path.display())
}
}
}

View File

@ -260,6 +260,7 @@ impl From<Project> for Payload {
}
#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod test {
use super::*;
use crate::assert_matches;

View File

@ -1 +1 @@
1.77
1.80