chore: Automated fixes generated by clippy
This commit is contained in:
parent
586eefc3e4
commit
9068033789
|
|
@ -171,8 +171,7 @@ pub fn authenticate(options: Options, profile: &Profile) -> anyhow::Result<()> {
|
|||
}
|
||||
for (key, _) in &profile.config.node.extra {
|
||||
term::warning(format!(
|
||||
"unused or deprecated configuration attribute {:?}",
|
||||
key
|
||||
"unused or deprecated configuration attribute {key:?}"
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ pub fn run(Options { op }: Options, ctx: impl term::Context) -> anyhow::Result<(
|
|||
oid
|
||||
}
|
||||
};
|
||||
println!("{}", oid);
|
||||
println!("{oid}");
|
||||
}
|
||||
Migrate => {
|
||||
let mut db = profile.cobs_db_mut()?;
|
||||
|
|
@ -501,7 +501,7 @@ pub fn run(Options { op }: Options, ctx: impl term::Context) -> anyhow::Result<(
|
|||
}
|
||||
};
|
||||
|
||||
println!("{}", oid);
|
||||
println!("{oid}");
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
|
@ -588,13 +588,13 @@ fn print_op_pretty(op: cob::Op<Vec<u8>>) -> anyhow::Result<()> {
|
|||
term::print(term::format::tertiary(format!("resource {oid}")));
|
||||
}
|
||||
for parent in op.parents {
|
||||
term::print(format!("parent {}", parent));
|
||||
term::print(format!("parent {parent}"));
|
||||
}
|
||||
for parent in op.related {
|
||||
term::print(format!("rel {}", parent));
|
||||
term::print(format!("rel {parent}"));
|
||||
}
|
||||
term::print(format!("author {}", op.author));
|
||||
term::print(format!("date {}", time));
|
||||
term::print(format!("date {time}"));
|
||||
term::blank();
|
||||
for action in op.actions {
|
||||
let obj: serde_json::Value = serde_json::from_slice(&action)?;
|
||||
|
|
|
|||
|
|
@ -68,11 +68,7 @@ fn debug(profile: Option<&Profile>) -> anyhow::Result<()> {
|
|||
}));
|
||||
|
||||
let debug = DebugInfo {
|
||||
rad_exe: if let Ok(filename) = std::env::current_exe() {
|
||||
Some(filename)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
rad_exe: std::env::current_exe().ok(),
|
||||
rad_version: VERSION,
|
||||
radicle_node_version: stdout_of("radicle-node", &["--version"])
|
||||
.unwrap_or("<unknown>".into()),
|
||||
|
|
|
|||
|
|
@ -396,8 +396,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
|||
Err(errs) => {
|
||||
term::error(format!("failed to verify delegates for {rid}"));
|
||||
term::error(format!(
|
||||
"the threshold of {} delegates cannot be met..",
|
||||
threshold
|
||||
"the threshold of {threshold} delegates cannot be met.."
|
||||
));
|
||||
for e in errs {
|
||||
print_delegate_verification_error(&e);
|
||||
|
|
|
|||
|
|
@ -582,7 +582,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
|||
})?
|
||||
.context("No issue with the given ID exists")?;
|
||||
if debug {
|
||||
println!("{:#?}", issue);
|
||||
println!("{issue:#?}");
|
||||
} else {
|
||||
term::issue::show(&issue, &id, format, &profile)?;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ pub fn row(
|
|||
Ok([
|
||||
match state {
|
||||
patch::State::Open { .. } => term::format::positive("●").into(),
|
||||
patch::State::Archived { .. } => term::format::yellow("●").into(),
|
||||
patch::State::Archived => term::format::yellow("●").into(),
|
||||
patch::State::Draft => term::format::dim("●").into(),
|
||||
patch::State::Merged { .. } => term::format::primary("✔").into(),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use super::*;
|
|||
|
||||
fn show_patch_diff(patch: &patch::Patch, stored: &Repository) -> anyhow::Result<()> {
|
||||
let (from, to) = patch.range()?;
|
||||
let range = format!("{}..{}", from, to);
|
||||
let range = format!("{from}..{to}");
|
||||
|
||||
process::Command::new("git")
|
||||
.current_dir(stored.path())
|
||||
|
|
@ -42,7 +42,7 @@ pub fn run(
|
|||
};
|
||||
|
||||
if debug {
|
||||
println!("{:#?}", patch);
|
||||
println!("{patch:#?}");
|
||||
return Ok(());
|
||||
}
|
||||
term::patch::show(&patch, patch_id, verbose, stored, workdir, profile)?;
|
||||
|
|
|
|||
|
|
@ -741,7 +741,7 @@ impl FetcherSpinner {
|
|||
required
|
||||
));
|
||||
} else {
|
||||
message.push_str(&format!("required {} more seed(s)", required));
|
||||
message.push_str(&format!("required {required} more seed(s)"));
|
||||
}
|
||||
self.spinner.message(message);
|
||||
self.spinner.failed();
|
||||
|
|
|
|||
|
|
@ -388,10 +388,7 @@ pub fn commit_ssh_fingerprint(path: &Path, sha1: &str) -> Result<Option<String>,
|
|||
.output()?;
|
||||
|
||||
if !output.status.success() {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
String::from_utf8_lossy(&output.stderr),
|
||||
));
|
||||
return Err(io::Error::other(String::from_utf8_lossy(&output.stderr)));
|
||||
}
|
||||
|
||||
let string = BufReader::new(output.stdout.as_slice())
|
||||
|
|
|
|||
|
|
@ -304,8 +304,7 @@ impl unified_diff::Decode for DiffModification {
|
|||
},
|
||||
(v1, v2) => {
|
||||
return Err(unified_diff::Error::syntax(format!(
|
||||
"indicator character expected, but got '{0}{1}'",
|
||||
v1, v2
|
||||
"indicator character expected, but got '{v1}{v2}'"
|
||||
)))
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -202,9 +202,9 @@ impl Decode for Diff {
|
|||
r.read_to_string(&mut s)?;
|
||||
|
||||
let d = git::raw::Diff::from_buffer(s.as_ref())
|
||||
.map_err(|e| Error::syntax(format!("decoding unified diff: {}", e)))?;
|
||||
let d = Diff::try_from(d)
|
||||
.map_err(|e| Error::syntax(format!("decoding unified diff: {}", e)))?;
|
||||
.map_err(|e| Error::syntax(format!("decoding unified diff: {e}")))?;
|
||||
let d =
|
||||
Diff::try_from(d).map_err(|e| Error::syntax(format!("decoding unified diff: {e}")))?;
|
||||
|
||||
Ok(d)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ pub mod patch {
|
|||
/// Format patch state.
|
||||
pub fn state(s: &State) -> term::Paint<String> {
|
||||
match s {
|
||||
State::Draft { .. } => term::format::dim(s.to_string()),
|
||||
State::Draft => term::format::dim(s.to_string()),
|
||||
State::Open { .. } => term::format::positive(s.to_string()),
|
||||
State::Archived => term::format::yellow(s.to_string()),
|
||||
State::Merged { .. } => term::format::secondary(s.to_string()),
|
||||
|
|
@ -366,10 +366,10 @@ pub mod identity {
|
|||
/// Format identity revision state.
|
||||
pub fn state(s: &State) -> term::Paint<String> {
|
||||
match s {
|
||||
State::Active { .. } => term::format::tertiary(s.to_string()),
|
||||
State::Accepted { .. } => term::format::positive(s.to_string()),
|
||||
State::Rejected { .. } => term::format::negative(s.to_string()),
|
||||
State::Stale { .. } => term::format::dim(s.to_string()),
|
||||
State::Active => term::format::tertiary(s.to_string()),
|
||||
State::Accepted => term::format::positive(s.to_string()),
|
||||
State::Rejected => term::format::negative(s.to_string()),
|
||||
State::Stale => term::format::dim(s.to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ pub fn get_create_message(
|
|||
|
||||
/// The message shown in the editor when editing a `Patch`.
|
||||
fn edit_display_message(title: &str, description: &str) -> String {
|
||||
format!("{}\n\n{}\n{PATCH_MSG}", title, description)
|
||||
format!("{title}\n\n{description}\n{PATCH_MSG}")
|
||||
.trim_start()
|
||||
.to_string()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@ fn nodes_renamed_for_option(
|
|||
let old: Address = value.into();
|
||||
if let Some(new) = NODES_RENAMED.get(&old) {
|
||||
warnings.push(format!(
|
||||
"Value of configuration option `{option}` at index {i} mentions node with address '{}', which has been renamed to '{}'. Please update your configuration.",
|
||||
old, new
|
||||
"Value of configuration option `{option}` at index {i} mentions node with address '{old}', which has been renamed to '{new}'. Please update your configuration."
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ fn rad_cob_multiset() {
|
|||
log::warn!(target: "test", "`jq` not found. Succeeding prematurely.");
|
||||
return;
|
||||
}
|
||||
Err(e) => panic!("while checking for jq: {}", e),
|
||||
Err(e) => panic!("while checking for jq: {e}"),
|
||||
Ok(_) => {}
|
||||
}
|
||||
}
|
||||
|
|
@ -1713,7 +1713,7 @@ fn test_cob_deletion() {
|
|||
)
|
||||
.unwrap();
|
||||
let issue_id = issue.id();
|
||||
log::debug!(target: "test", "Issue {} created", issue_id);
|
||||
log::debug!(target: "test", "Issue {issue_id} created");
|
||||
|
||||
bob.rad("clone", &[rid.to_string().as_str()], working.path())
|
||||
.unwrap();
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ fn copy_to(
|
|||
object: ObjectId,
|
||||
) -> Result<(), git2::Error> {
|
||||
let original = {
|
||||
let name = format!("refs/rad/{}/cobs/{}/{}", from, typename, object);
|
||||
let name = format!("refs/rad/{from}/cobs/{typename}/{object}");
|
||||
let r = repo.find_reference(&name)?;
|
||||
r.target().unwrap()
|
||||
};
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ impl FetchState {
|
|||
.collect::<Vec<_>>(),
|
||||
None => vec![],
|
||||
};
|
||||
log::trace!(target: "fetch", "Received refs {:?}", refs);
|
||||
log::trace!(target: "fetch", "Received refs {refs:?}");
|
||||
step.pre_validate(&refs)?;
|
||||
|
||||
let wants_haves = step.wants_haves(&handle.repo, &refs)?;
|
||||
|
|
@ -318,7 +318,7 @@ impl FetchState {
|
|||
}
|
||||
None => {
|
||||
let followed = handle.allowed();
|
||||
log::trace!(target: "fetch", "Followed nodes {:?}", followed);
|
||||
log::trace!(target: "fetch", "Followed nodes {followed:?}");
|
||||
let special_refs = stage::SpecialRefs {
|
||||
blocked: handle.blocked.clone(),
|
||||
remote,
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ where
|
|||
}
|
||||
|
||||
fn io_other(err: impl std::error::Error + Send + Sync + 'static) -> io::Error {
|
||||
io::Error::new(io::ErrorKind::Other, err)
|
||||
io::Error::other(err)
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
|
|
|
|||
|
|
@ -46,8 +46,7 @@ where
|
|||
} = handshake;
|
||||
|
||||
if protocol != &Protocol::V2 {
|
||||
return Err(ls_refs::Error::Io(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
return Err(ls_refs::Error::Io(io::Error::other(
|
||||
"expected protocol version 2",
|
||||
)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ where
|
|||
}
|
||||
});
|
||||
}
|
||||
Err(e) => log::error!(target: "control", "Failed to accept incoming connection: {}", e),
|
||||
Err(e) => log::error!(target: "control", "Failed to accept incoming connection: {e}"),
|
||||
}
|
||||
}
|
||||
log::debug!(target: "control", "Exiting control loop..");
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ impl Runtime {
|
|||
let policy = config.seeding_policy.into();
|
||||
|
||||
for (key, _) in &config.extra {
|
||||
log::warn!(target: "node", "Unused or deprecated configuration attribute {:?}", key);
|
||||
log::warn!(target: "node", "Unused or deprecated configuration attribute {key:?}");
|
||||
}
|
||||
|
||||
log::info!(target: "node", "Opening policy database..");
|
||||
|
|
@ -158,7 +158,7 @@ impl Runtime {
|
|||
}
|
||||
|
||||
log::info!(target: "node", "Default seeding policy set to '{}'", &policy);
|
||||
log::info!(target: "node", "Initializing service ({:?})..", network);
|
||||
log::info!(target: "node", "Initializing service ({network:?})..");
|
||||
|
||||
let announcement = if let Some(ann) = fs::read(node_dir.join(node::NODE_ANNOUNCEMENT_FILE))
|
||||
.ok()
|
||||
|
|
|
|||
|
|
@ -275,8 +275,8 @@ impl radicle::node::Handle for Handle {
|
|||
let query: Arc<QueryState> = Arc::new(move |state| {
|
||||
let sessions = state
|
||||
.sessions()
|
||||
.iter()
|
||||
.map(|(_, s)| radicle::node::Session::from(s))
|
||||
.values()
|
||||
.map(radicle::node::Session::from)
|
||||
.collect();
|
||||
sender.send(sessions).ok();
|
||||
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ where
|
|||
if let Some((time, next)) = priority.or_else(|| self.inbox.next()) {
|
||||
let elapsed = (time - self.start_time).as_millis();
|
||||
if matches!(next.input, Input::Wake) {
|
||||
trace!(target: "sim", "{:05} {}", elapsed, next);
|
||||
trace!(target: "sim", "{elapsed:05} {next}");
|
||||
} else {
|
||||
// TODO: This can be confusing, since this event may not actually be passed to
|
||||
// the service. It would be best to only log the events that are being sent
|
||||
|
|
@ -477,8 +477,7 @@ where
|
|||
// Drop message if nodes are partitioned.
|
||||
info!(
|
||||
target: "sim",
|
||||
"{} -> {} (DROPPED)",
|
||||
sender, receiver,
|
||||
"{sender} -> {receiver} (DROPPED)",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
@ -497,8 +496,7 @@ where
|
|||
for msg in &msgs {
|
||||
info!(
|
||||
target: "sim",
|
||||
"{:05} {} -> {} ({:?}) (+{})",
|
||||
elapsed, sender, receiver, msg, latency
|
||||
"{elapsed:05} {sender} -> {receiver} ({msg:?}) (+{latency})"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -528,7 +526,7 @@ where
|
|||
|
||||
// Fail to connect if the nodes are partitioned.
|
||||
if self.is_partitioned(node, remote) {
|
||||
log::info!(target: "sim", "{} -/-> {} (partitioned)", node, remote);
|
||||
log::info!(target: "sim", "{node} -/-> {remote} (partitioned)");
|
||||
|
||||
// Sometimes, the service gets a failure input, other times it just hangs.
|
||||
if self.rng.borrow_mut().bool() {
|
||||
|
|
|
|||
|
|
@ -918,7 +918,7 @@ fn test_non_fastforward_sigrefs() {
|
|||
let old_bob = match up {
|
||||
RefUpdate::Created { oid, .. } => oid,
|
||||
RefUpdate::Skipped { oid, .. } => oid,
|
||||
_ => panic!("rad/sigrefs should have been created or skipped: {:?}", up),
|
||||
_ => panic!("rad/sigrefs should have been created or skipped: {up:?}"),
|
||||
};
|
||||
assert_eq!(bob_sigrefs, old_bob);
|
||||
|
||||
|
|
@ -930,7 +930,7 @@ fn test_non_fastforward_sigrefs() {
|
|||
.unwrap()
|
||||
.reference_oid(&bob.id, &radicle::storage::refs::SIGREFS_BRANCH)
|
||||
.unwrap();
|
||||
log::debug!(target: "test", "bob's old 'rad/sigrefs': {}", before);
|
||||
log::debug!(target: "test", "bob's old 'rad/sigrefs': {before}");
|
||||
}
|
||||
|
||||
// Now Eve disconnects from Bob so she doesn't fetch his update.
|
||||
|
|
@ -961,7 +961,7 @@ fn test_non_fastforward_sigrefs() {
|
|||
RefUpdate::Updated { new, .. } => new,
|
||||
// FIXME: Really it shouldn't be skipped but let's see what happens
|
||||
RefUpdate::Skipped { oid, .. } => oid,
|
||||
_ => panic!("rad/sigrefs should have been updated {:?}", up),
|
||||
_ => panic!("rad/sigrefs should have been updated {up:?}"),
|
||||
};
|
||||
assert_eq!(bob_sigrefs, new_bob);
|
||||
|
||||
|
|
@ -973,7 +973,7 @@ fn test_non_fastforward_sigrefs() {
|
|||
.unwrap()
|
||||
.reference_oid(&bob.id, &radicle::storage::refs::SIGREFS_BRANCH)
|
||||
.unwrap();
|
||||
log::debug!(target: "test", "bob's new 'rad/sigrefs': {}", after);
|
||||
log::debug!(target: "test", "bob's new 'rad/sigrefs': {after}");
|
||||
}
|
||||
|
||||
assert_matches!(
|
||||
|
|
@ -1542,7 +1542,6 @@ fn test_channel_reader_limit() {
|
|||
assert!(
|
||||
reason.contains("Failed to consume the pack sent by the remote")
|
||||
|| reason.contains("exceeded number of allowed bytes"),
|
||||
"actual: {}",
|
||||
reason
|
||||
"actual: {reason}"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -959,7 +959,7 @@ where
|
|||
e.remove();
|
||||
}
|
||||
Peer::Connected { nid, .. } => {
|
||||
panic!("Wire::handover_transport: Unexpected handover of connected peer {} with id={id} (fd={fd})", nid);
|
||||
panic!("Wire::handover_transport: Unexpected handover of connected peer {nid} with id={id} (fd={fd})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,8 +171,7 @@ impl ReadLimiter {
|
|||
self.total_read = self.total_read.saturating_add(bytes);
|
||||
log::trace!(target: "worker", "limit {}, total bytes read: {}", self.limit, self.total_read);
|
||||
if self.limit.exceeded_by(self.total_read) {
|
||||
Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
Err(io::Error::other(
|
||||
"sender has exceeded number of allowed bytes, aborting read",
|
||||
))
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ impl Handle {
|
|||
validations,
|
||||
} => {
|
||||
for fail in validations.iter() {
|
||||
log::error!(target: "worker", "Validation error: {}", fail);
|
||||
log::error!(target: "worker", "Validation error: {fail}");
|
||||
}
|
||||
Err(error::Fetch::Validation {
|
||||
threshold,
|
||||
|
|
@ -109,7 +109,7 @@ impl Handle {
|
|||
validations,
|
||||
} => {
|
||||
for warn in validations {
|
||||
log::warn!(target: "worker", "Validation error: {}", warn);
|
||||
log::warn!(target: "worker", "Validation error: {warn}");
|
||||
}
|
||||
|
||||
// N.b. We do not go through handle for this since the cloning handle
|
||||
|
|
@ -180,7 +180,7 @@ fn mv(tmp: tempfile::TempDir, storage: &Storage, rid: &RepoId) -> Result<(), err
|
|||
log::warn!(target: "worker", "Refusing to move cloned repository {rid} already exists");
|
||||
return Err(Error::new(
|
||||
ErrorKind::AlreadyExists,
|
||||
format!("repository already exists {:?}", to),
|
||||
format!("repository already exists {to:?}"),
|
||||
)
|
||||
.into());
|
||||
}
|
||||
|
|
@ -402,8 +402,7 @@ fn set_canonical_refs(repo: &Repository, applied: &Applied) -> Result<(), error:
|
|||
Err(err) => {
|
||||
log::warn!(
|
||||
target: "worker",
|
||||
"Failed to calculate canonical reference: {}",
|
||||
err,
|
||||
"Failed to calculate canonical reference: {err}",
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -416,9 +415,7 @@ fn set_canonical_refs(repo: &Repository, applied: &Applied) -> Result<(), error:
|
|||
) {
|
||||
log::warn!(
|
||||
target: "worker",
|
||||
"Failed to set canonical reference {}->{}: {e}",
|
||||
refname,
|
||||
oid
|
||||
"Failed to set canonical reference {refname}->{oid}: {e}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -847,7 +847,7 @@ where
|
|||
}
|
||||
|
||||
pub fn command(&mut self, cmd: Command) {
|
||||
info!(target: "service", "Received command {:?}", cmd);
|
||||
info!(target: "service", "Received command {cmd:?}");
|
||||
|
||||
match cmd {
|
||||
Command::Connect(nid, addr, opts) => {
|
||||
|
|
@ -1396,7 +1396,7 @@ where
|
|||
let Some(session) = self.sessions.get_mut(&remote) else {
|
||||
// Since we sometimes disconnect the service eagerly, it's not unusual to get a second
|
||||
// disconnection event once the transport is dropped.
|
||||
trace!(target: "service", "Redundant disconnection for {} ({})", remote, reason);
|
||||
trace!(target: "service", "Redundant disconnection for {remote} ({reason})");
|
||||
return;
|
||||
};
|
||||
// In cases of connection conflicts, there may be disconnections of one of the two
|
||||
|
|
@ -1405,7 +1405,7 @@ where
|
|||
return;
|
||||
}
|
||||
|
||||
info!(target: "service", "Disconnected from {} ({})", remote, reason);
|
||||
info!(target: "service", "Disconnected from {remote} ({reason})");
|
||||
self.emitter.emit(Event::PeerDisconnected {
|
||||
nid: remote,
|
||||
reason: reason.to_string(),
|
||||
|
|
@ -1836,7 +1836,7 @@ where
|
|||
//
|
||||
// This is not ideal, but until the wire protocol and service are unified, it's the simplest
|
||||
// solution to converge towards the same state.
|
||||
session::State::Attempted { .. } | session::State::Initial => {
|
||||
session::State::Attempted | session::State::Initial => {
|
||||
debug!(target: "service", "Received unexpected message from connecting peer {}", peer.id);
|
||||
debug!(target: "service", "Transitioning peer {} to 'connected' state", peer.id);
|
||||
|
||||
|
|
@ -1978,7 +1978,7 @@ where
|
|||
if let Ok(result) = self.db.routing_mut().add_inventory([&rid], nid, time) {
|
||||
if let &[(_, InsertResult::SeedAdded)] = result.as_slice() {
|
||||
self.emitter.emit(Event::SeedDiscovered { rid, nid });
|
||||
info!(target: "service", "Routing table updated for {} with seed {nid}", rid);
|
||||
info!(target: "service", "Routing table updated for {rid} with seed {nid}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2143,8 +2143,7 @@ where
|
|||
if refs.push(refs_at).is_err() {
|
||||
warn!(
|
||||
target: "service",
|
||||
"refs announcement limit ({}) exceeded, peers will see only some of your repository references",
|
||||
REF_REMOTE_LIMIT,
|
||||
"refs announcement limit ({REF_REMOTE_LIMIT}) exceeded, peers will see only some of your repository references",
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ pub use store::{AnnouncementId, Error, RelayStatus, Store};
|
|||
|
||||
/// This node's user agent string.
|
||||
pub static PROTOCOL_VERSION_STRING: LazyLock<UserAgent> = LazyLock::new(|| {
|
||||
FromStr::from_str(format!("/radicle:{}/", PROTOCOL_VERSION).as_str())
|
||||
FromStr::from_str(format!("/radicle:{PROTOCOL_VERSION}/").as_str())
|
||||
.expect("user agent is valid")
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ impl Session {
|
|||
}
|
||||
|
||||
pub fn is_connecting(&self) -> bool {
|
||||
matches!(self.state, State::Attempted { .. })
|
||||
matches!(self.state, State::Attempted)
|
||||
}
|
||||
|
||||
pub fn is_stable(&self) -> bool {
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ impl<M: wire::Decode> wire::Decode for Frame<M> {
|
|||
|
||||
Ok(frame)
|
||||
}
|
||||
Ok(StreamKind::Git { .. }) => {
|
||||
Ok(StreamKind::Git) => {
|
||||
let data = varint::payload::decode(buf)?;
|
||||
Ok(Frame::git(stream, data))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -866,13 +866,10 @@ fn push_ref(
|
|||
[],
|
||||
)
|
||||
.map_err(|err| {
|
||||
Error::Io(std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
format!(
|
||||
"failed to run `git push {url} {refspec}` in {:?}: {err}",
|
||||
working.path()
|
||||
),
|
||||
))
|
||||
Error::Io(std::io::Error::other(format!(
|
||||
"failed to run `git push {url} {refspec}` in {:?}: {err}",
|
||||
working.path()
|
||||
)))
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ impl Schema {
|
|||
|
||||
fn main() {
|
||||
if let Err(e) = print_schema() {
|
||||
eprintln!("{}", e);
|
||||
eprintln!("{e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ pub fn spinner_to(
|
|||
} => {
|
||||
let spinner = DEFAULT_STYLE[*cursor];
|
||||
|
||||
write!(animation, "\r{}{spinner} {message}", CLEAR_UNTIL_NEWLINE,).ok();
|
||||
write!(animation, "\r{CLEAR_UNTIL_NEWLINE}{spinner} {message}",).ok();
|
||||
|
||||
*cursor += 1;
|
||||
*cursor %= DEFAULT_STYLE.len();
|
||||
|
|
|
|||
|
|
@ -90,10 +90,7 @@ impl CanonicalFormatter {
|
|||
/// Returns a mutable reference to the top of the object stack.
|
||||
fn obj_mut(&mut self) -> Result<&mut Object> {
|
||||
self.object_stack.last_mut().ok_or_else(|| {
|
||||
Error::new(
|
||||
ErrorKind::Other,
|
||||
"serde_json called an object method without calling begin_object first",
|
||||
)
|
||||
Error::other("serde_json called an object method without calling begin_object first")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -192,8 +189,7 @@ impl Formatter for CanonicalFormatter {
|
|||
|
||||
fn end_object<W: Write + ?Sized>(&mut self, writer: &mut W) -> Result<()> {
|
||||
let object = self.object_stack.pop().ok_or_else(|| {
|
||||
Error::new(
|
||||
ErrorKind::Other,
|
||||
Error::other(
|
||||
"serde_json called Formatter::end_object object method
|
||||
without calling begin_object first",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -663,9 +663,9 @@ impl Patch {
|
|||
// The patch author can edit the patch and change its state.
|
||||
Action::Edit { .. } => Authorization::from(actor == author),
|
||||
Action::Lifecycle { state } => Authorization::from(match state {
|
||||
Lifecycle::Open { .. } => actor == author,
|
||||
Lifecycle::Draft { .. } => actor == author,
|
||||
Lifecycle::Archived { .. } => actor == author,
|
||||
Lifecycle::Open => actor == author,
|
||||
Lifecycle::Draft => actor == author,
|
||||
Lifecycle::Archived => actor == author,
|
||||
}),
|
||||
// Only delegates can carry out these actions.
|
||||
Action::Label { labels } => {
|
||||
|
|
|
|||
|
|
@ -744,10 +744,7 @@ where
|
|||
return Ok(String::from_utf8_lossy(out).into());
|
||||
}
|
||||
|
||||
Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
String::from_utf8_lossy(&output.stderr),
|
||||
))
|
||||
Err(io::Error::other(String::from_utf8_lossy(&output.stderr)))
|
||||
}
|
||||
|
||||
/// Functions that call to the `git` CLI instead of `git2`.
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ mod test {
|
|||
)
|
||||
.unwrap();
|
||||
let verified = super::verify(raw);
|
||||
assert!(verified.is_ok(), "Unexpected error {:?}", verified);
|
||||
assert!(verified.is_ok(), "Unexpected error {verified:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -784,7 +784,6 @@ impl Session {
|
|||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
|
||||
pub struct Seed {
|
||||
/// The Node ID.
|
||||
#[cfg_attr(
|
||||
|
|
|
|||
|
|
@ -745,7 +745,7 @@ mod test {
|
|||
let path = tmp.path().join("Home").join("Radicle");
|
||||
fs::create_dir_all(path.clone()).unwrap();
|
||||
|
||||
let last = tmp.path().components().last().unwrap();
|
||||
let last = tmp.path().components().next_back().unwrap();
|
||||
let home = Home::new(
|
||||
tmp.path()
|
||||
.join("..")
|
||||
|
|
|
|||
|
|
@ -417,8 +417,8 @@ impl Remote<Verified> {
|
|||
let ns = self.id.to_namespace();
|
||||
// Nb. the references in Refs are expected to be Qualified
|
||||
self.refs
|
||||
.iter()
|
||||
.map(|(name, _)| {
|
||||
.keys()
|
||||
.map(|name| {
|
||||
let name = PatternString::from(ns.join(name));
|
||||
Refspec {
|
||||
src: name.clone(),
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ impl Storage {
|
|||
if self.contains(&rid)? {
|
||||
return Err(Error::Io(io::Error::new(
|
||||
io::ErrorKind::AlreadyExists,
|
||||
format!("refusing to create '{}.lock'", rid),
|
||||
format!("refusing to create '{rid}.lock'"),
|
||||
))
|
||||
.into());
|
||||
}
|
||||
|
|
@ -852,7 +852,7 @@ impl WriteRepository for Repository {
|
|||
self.raw()
|
||||
.reference(&branch_ref, *new, true, "set-local-branch (radicle)")?;
|
||||
|
||||
log::debug!(target: "storage", "Setting ref: {} -> {}", head_ref, branch_ref);
|
||||
log::debug!(target: "storage", "Setting ref: {head_ref} -> {branch_ref}");
|
||||
self.raw()
|
||||
.reference_symbolic(&head_ref, &branch_ref, true, "set-head (radicle)")?;
|
||||
|
||||
|
|
@ -1023,8 +1023,8 @@ mod tests {
|
|||
let mut refs = repo
|
||||
.references_of(signer.public_key())
|
||||
.unwrap()
|
||||
.iter()
|
||||
.map(|(r, _)| r.to_string())
|
||||
.keys()
|
||||
.map(|r| r.to_string())
|
||||
.collect::<Vec<_>>();
|
||||
refs.sort();
|
||||
|
||||
|
|
|
|||
|
|
@ -156,8 +156,7 @@ impl cob::object::Storage for Repository {
|
|||
(*entry).into(),
|
||||
true,
|
||||
&format!(
|
||||
"Updating collaborative object '{}/{}' with new entry {}",
|
||||
typename, object_id, entry,
|
||||
"Updating collaborative object '{typename}/{object_id}' with new entry {entry}",
|
||||
),
|
||||
)?;
|
||||
|
||||
|
|
@ -433,8 +432,7 @@ impl<R: storage::WriteRepository> cob::object::Storage for DraftStore<'_, R> {
|
|||
(*entry).into(),
|
||||
true,
|
||||
&format!(
|
||||
"Updating draft collaborative object '{}/{}' with new entry {}",
|
||||
typename, object_id, entry,
|
||||
"Updating draft collaborative object '{typename}/{object_id}' with new entry {entry}",
|
||||
),
|
||||
)?;
|
||||
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ impl SignedRefs<Verified> {
|
|||
Ok(oid) => Ok(Updated::Updated { oid: oid.into() }),
|
||||
Err(e) => match (e.class(), e.code()) {
|
||||
(git2::ErrorClass::Object, git2::ErrorCode::Modified) => {
|
||||
log::warn!("Concurrent modification of refs: {:?}", e);
|
||||
log::warn!("Concurrent modification of refs: {e:?}");
|
||||
|
||||
Err(Error::Git(e))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue