Upgrade Rust to 1.66

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
Alexis Sellier 2022-12-15 19:25:47 +01:00
parent b32ae984ce
commit f26674a5a9
No known key found for this signature in database
23 changed files with 47 additions and 48 deletions

View File

@ -15,7 +15,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.65
toolchain: 1.66
- name: Build
run: cargo build --verbose --all-features
env:
@ -43,7 +43,7 @@ jobs:
with:
profile: minimal
components: clippy, rustfmt
toolchain: 1.65
toolchain: 1.66
- name: Cache cargo registry
uses: actions/cache@v1
with:

View File

@ -85,13 +85,13 @@ pub fn init(options: Options) -> anyhow::Result<()> {
term::success!(
"Profile {} created.",
term::format::highlight(&profile.id().to_string())
term::format::highlight(profile.id().to_string())
);
term::blank();
term::info!(
"Your radicle Node ID is {}. This identifies your device.",
term::format::highlight(&profile.id().to_string())
term::format::highlight(profile.id().to_string())
);
term::blank();

View File

@ -139,7 +139,7 @@ pub fn setup_remotes(setup: project::SetupRemote, remotes: &[NodeId]) -> anyhow:
term::success!("Remote {} set", term::format::highlight(remote));
term::success!(
"Remote-tracking branch {} created for {}",
term::format::highlight(&branch),
term::format::highlight(branch),
term::format::tertiary(term::format::node(remote_id))
);
}

View File

@ -155,7 +155,7 @@ pub fn init(options: Options, profile: &profile::Profile) -> anyhow::Result<()>
if path == cwd {
term::format::highlight(".")
} else {
term::format::highlight(&path.display())
term::format::highlight(path.display())
}
));
@ -271,7 +271,7 @@ pub fn setup_signing(
));
true
} else if interactive.yes() {
term::confirm(&format!(
term::confirm(format!(
"Configure 🌱 signing key {} in local checkout?",
term::format::tertiary(key),
))
@ -296,7 +296,7 @@ pub fn setup_signing(
if ssh_keys.contains(&ssh_key) {
term::success!("Signing key is already in {} file", gitsigners);
} else if term::confirm(&format!("Add signing key to {}?", gitsigners)) {
} else if term::confirm(format!("Add signing key to {}?", gitsigners)) {
git::add_gitsigners(repo, [node_id])?;
}
}

View File

@ -150,7 +150,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
let repo = storage.repository(id)?;
let head = Doc::<Untrusted>::head(signer.public_key(), &repo)?;
let history = repo.revwalk(head)?.collect::<Vec<_>>();
let revision = history.len() as usize;
let revision = history.len();
for (counter, oid) in history.into_iter().rev().enumerate() {
let oid = oid?.into();

View File

@ -177,11 +177,11 @@ pub fn run(
term::info!(
"{}/{} ({}) <- {}/{} ({})",
term::format::dim(target_peer.id),
term::format::highlight(&project.default_branch.to_string()),
term::format::secondary(&term::format::oid(*target_oid)),
term::format::highlight(project.default_branch.to_string()),
term::format::secondary(term::format::oid(*target_oid)),
term::format::dim(term::format::node(patches.public_key())),
term::format::highlight(&head_branch.to_string()),
term::format::secondary(&term::format::oid(head_oid)),
term::format::highlight(head_branch.to_string()),
term::format::secondary(term::format::oid(head_oid)),
);
// TODO: Test case where the target branch has been re-written passed the merge-base, since the fork was created
@ -223,7 +223,7 @@ pub fn run(
}
term::blank();
term::print(&term::format::dim(format!(
term::print(term::format::dim(format!(
"╰{}",
"".repeat(term::text_width(title_pretty) - 1)
)));

View File

@ -39,11 +39,11 @@ pub fn run(
}
}
term::blank();
term::print(&term::format::badge_positive("YOU PROPOSED"));
term::print(term::format::badge_positive("YOU PROPOSED"));
if own.is_empty() {
term::blank();
term::print(&term::format::italic("Nothing to show."));
term::print(term::format::italic("Nothing to show."));
} else {
for (id, patch) in &mut own {
term::blank();
@ -52,11 +52,11 @@ pub fn run(
}
}
term::blank();
term::print(&term::format::badge_secondary("OTHERS PROPOSED"));
term::print(term::format::badge_secondary("OTHERS PROPOSED"));
if other.is_empty() {
term::blank();
term::print(&term::format::italic("Nothing to show."));
term::print(term::format::italic("Nothing to show."));
} else {
for (id, patch) in &mut other {
term::blank();

View File

@ -122,10 +122,10 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
}
args.push("rad"); // Push to "rad" remote.
term::subcommand(&format!("git {}", args.join(" ")));
term::subcommand(format!("git {}", args.join(" ")));
// Push to storage.
match git::run::<_, _, &str, &str>(&cwd, args, []) {
match git::run::<_, _, &str, &str>(cwd, args, []) {
Ok(output) => term::blob(output),
Err(err) => return Err(err.into()),
}

View File

@ -81,7 +81,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
let id = options.id;
if let Ok(Some(_)) = storage.get(signer.public_key(), id.to_owned()) {
let namespace = profile.paths().storage().join(&id.to_human());
let namespace = profile.paths().storage().join(id.to_human());
if !options.confirm
|| term::confirm(format!(

View File

@ -94,11 +94,11 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
let storage = &profile.storage;
let (_, rid) = radicle::rad::cwd().context("this command must be run within a project")?;
let project = storage.repository(rid)?.project_of(profile.id())?;
let mut node = radicle::node::connect(&profile.node())?;
let mut node = radicle::node::connect(profile.node())?;
term::info!(
"Establishing 🌱 tracking relationship for {}",
term::format::highlight(&project.name)
term::format::highlight(project.name)
);
term::blank();

View File

@ -23,7 +23,7 @@ fn main() {
Ok(_) => process::exit(0),
Err(err) => {
if let Some(err) = err {
term::error(&format!("Error: rad: {}", err));
term::error(format!("Error: rad: {}", err));
}
process::exit(1);
}

View File

@ -14,6 +14,16 @@ pub struct Table<const W: usize> {
opts: TableOptions,
}
impl<const W: usize> Default for Table<W> {
fn default() -> Self {
Self {
rows: Vec::new(),
widths: [0; W],
opts: TableOptions::default(),
}
}
}
impl<const W: usize> Table<W> {
pub fn new(opts: TableOptions) -> Self {
Self {
@ -23,14 +33,6 @@ impl<const W: usize> Table<W> {
}
}
pub fn default() -> Self {
Self {
rows: Vec::new(),
widths: [0; W],
opts: TableOptions::default(),
}
}
pub fn push(&mut self, row: [String; W]) {
for (i, cell) in row.iter().enumerate() {
self.widths[i] = self.widths[i].max(console::measure_text_width(cell));

View File

@ -25,6 +25,6 @@ impl Arbitrary for PublicKey {
impl Arbitrary for hash::Digest {
fn arbitrary(g: &mut qcheck::Gen) -> Self {
let bytes: Vec<u8> = Arbitrary::arbitrary(g);
hash::Digest::new(&bytes)
hash::Digest::new(bytes)
}
}

View File

@ -326,7 +326,7 @@ mod test {
fn test_empty() {
let tmp = tempfile::tempdir().unwrap();
let path = tmp.path().join("cache");
let cache = Book::open(&path).unwrap();
let cache = Book::open(path).unwrap();
assert!(cache.is_empty().unwrap());
}

View File

@ -294,7 +294,7 @@ impl Announcement {
/// Verify this announcement's signature.
pub fn verify(&self) -> bool {
let msg = wire::serialize(&self.message);
self.node.verify(&msg, &self.signature).is_ok()
self.node.verify(msg, &self.signature).is_ok()
}
pub fn matches(&self, filter: &Filter) -> bool {

View File

@ -126,10 +126,7 @@ impl Encode for PublicKey {
impl<const T: usize> Encode for &[u8; T] {
fn encode<W: io::Write + ?Sized>(&self, writer: &mut W) -> Result<usize, io::Error> {
// TODO: This can be removed when the clippy bugs are fixed
#[allow(clippy::explicit_auto_deref)]
writer.write_all(*self)?;
writer.write_all(&**self)?;
Ok(mem::size_of::<Self>())
}
}

View File

@ -108,7 +108,7 @@ pub fn run(profile: radicle::Profile) -> Result<(), Box<dyn std::error::Error +
// Connect to local node and announce refs to the network.
// If our node is not running, we simply skip this step, as the
// refs will be announced eventually, when the node restarts.
if let Ok(mut conn) = radicle::node::connect(&profile.node()) {
if let Ok(mut conn) = radicle::node::connect(profile.node()) {
conn.announce_refs(url.repo)?;
}
}

View File

@ -16,7 +16,7 @@ fn main() -> anyhow::Result<()> {
let sigrefs = project.sign_refs(&signer)?;
let head = project.set_head()?;
radicle::node::connect(&profile.node())?.announce_refs(id)?;
radicle::node::connect(profile.node())?.announce_refs(id)?;
println!("head: {}", head);
println!("ok: {}", sigrefs.signature);

View File

@ -59,7 +59,7 @@ pub struct Profile {
impl Profile {
pub fn init(home: impl AsRef<Path>, passphrase: &str) -> Result<Self, Error> {
let home = home.as_ref().to_path_buf();
let storage = Storage::open(&home.join("storage"))?;
let storage = Storage::open(home.join("storage"))?;
let keystore = Keystore::new(&home.join("keys"));
let public_key = keystore.init("radicle", passphrase)?;
@ -75,7 +75,7 @@ impl Profile {
pub fn load() -> Result<Self, Error> {
let home = self::home()?;
let storage = Storage::open(&home.join("storage"))?;
let storage = Storage::open(home.join("storage"))?;
let keystore = Keystore::new(&home.join("keys"));
let public_key = keystore
.public_key()?

View File

@ -392,7 +392,7 @@ mod tests {
let (_, head) = project_repo.head().unwrap();
// Test canonical refs.
assert_eq!(refs.head(&component!("master")).unwrap(), head);
assert_eq!(refs.head(component!("master")).unwrap(), head);
assert_eq!(project_repo.raw().refname_to_id("HEAD").unwrap(), *head);
assert_eq!(
project_repo

View File

@ -1059,7 +1059,7 @@ mod tests {
let addr = socket.local_addr().unwrap();
let source_path = tmp.path().join("source");
let target_path = tmp.path().join("target");
let (source, _) = fixtures::repository(&source_path);
let (source, _) = fixtures::repository(source_path);
transport::local::register(storage.clone());

View File

@ -76,7 +76,7 @@ impl Refs {
let refs = self;
let msg = refs.canonical();
match signer.verify(&msg, &signature) {
match signer.verify(msg, &signature) {
Ok(()) => Ok(SignedRefs {
refs,
signature,
@ -230,7 +230,7 @@ impl SignedRefs<Unverified> {
pub fn verify(&self, signer: &PublicKey) -> Result<(), crypto::Error> {
let canonical = self.refs.canonical();
match signer.verify(&canonical, &self.signature) {
match signer.verify(canonical, &self.signature) {
Ok(()) => Ok(()),
Err(e) => Err(e),
}

View File

@ -1 +1 @@
1.65
1.66