From 703692371260a19ecf79abd7c38bd511c6c120dc Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Mon, 30 Jan 2023 10:20:26 +0000 Subject: [PATCH] nix: update to rust-1.67 Rust 1.67 was announced[0]. Update the nix sources to be on par with the latest rustc version. This required fixes to clippy warnings for using variable interpolation for format strings. There was also an advisory error related to libgit2-sys[1], which is transitively depended on via git2. The fix is included in the 0.16.1 version of git2. [0]: https://blog.rust-lang.org/2023/01/26/Rust-1.67.0.html [1]: https://rustsec.org/advisories/RUSTSEC-2023-0003 Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- git-commit/Cargo.toml | 2 +- git-commit/src/lib.rs | 4 ++-- git-commit/t/Cargo.toml | 2 +- git-commit/t/src/integration.rs | 2 +- git-storage/Cargo.toml | 4 ++-- git-storage/src/backend/write.rs | 4 ++-- git-storage/src/odb/write.rs | 4 ++-- git-storage/t/Cargo.toml | 2 +- git-storage/t/src/tmp.rs | 2 +- link-git/Cargo.toml | 2 +- link-git/src/protocol/transport.rs | 2 +- link-git/src/protocol/upload_pack.rs | 2 +- link-git/src/protocol/upload_pack/legacy.rs | 5 +---- link-git/t/Cargo.toml | 2 +- nix/sources.json | 12 ++++++------ radicle-git-ext/Cargo.toml | 2 +- radicle-git-ext/src/reference/name.rs | 4 ++-- radicle-git-ext/t/Cargo.toml | 2 +- radicle-git-types/Cargo.toml | 2 +- radicle-git-types/src/reference.rs | 2 +- radicle-git-types/src/refspec.rs | 2 +- radicle-surf/Cargo.toml | 2 +- radicle-surf/build.rs | 2 +- radicle-surf/examples/browsing.rs | 2 +- radicle-surf/examples/diff.rs | 6 +++--- radicle-surf/src/fs.rs | 8 ++------ radicle-surf/t/Cargo.toml | 2 +- 27 files changed, 40 insertions(+), 47 deletions(-) diff --git a/git-commit/Cargo.toml b/git-commit/Cargo.toml index a36245c..4deba1f 100644 --- a/git-commit/Cargo.toml +++ b/git-commit/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["git", "radicle"] thiserror = "1" [dependencies.git2] -version = "0.15.0" +version = "0.16.1" default-features = false features = ["vendored-libgit2"] diff --git a/git-commit/src/lib.rs b/git-commit/src/lib.rs index c63f79b..e41f530 100644 --- a/git-commit/src/lib.rs +++ b/git-commit/src/lib.rs @@ -276,14 +276,14 @@ impl ToString for Commit { writeln!(buf, "tree {}", self.tree).ok(); for parent in &self.parents { - writeln!(buf, "parent {}", parent).ok(); + writeln!(buf, "parent {parent}").ok(); } writeln!(buf, "author {}", self.author).ok(); writeln!(buf, "committer {}", self.committer).ok(); for (name, value) in self.headers.iter() { - writeln!(buf, "{} {}", name, value.replace('\n', "\n ")).ok(); + writeln!(buf, "{name} {}", value.replace('\n', "\n ")).ok(); } writeln!(buf).ok(); write!(buf, "{}", self.message.trim()).ok(); diff --git a/git-commit/t/Cargo.toml b/git-commit/t/Cargo.toml index dd147bf..1d8a1df 100644 --- a/git-commit/t/Cargo.toml +++ b/git-commit/t/Cargo.toml @@ -18,7 +18,7 @@ test = [] path = ".." [dev-dependencies.git2] -version = "0.15.0" +version = "0.16.1" default-features = false features = ["vendored-libgit2"] diff --git a/git-commit/t/src/integration.rs b/git-commit/t/src/integration.rs index bf51b1a..afb0332 100644 --- a/git-commit/t/src/integration.rs +++ b/git-commit/t/src/integration.rs @@ -23,6 +23,6 @@ fn valid_commits() { for oid in walk.take(20) { let oid = oid.unwrap(); let commit = Commit::read(&repo, oid); - assert!(commit.is_ok(), "Oid: {}, Error: {:?}", oid, commit) + assert!(commit.is_ok(), "Oid: {oid}, Error: {commit:?}") } } diff --git a/git-storage/Cargo.toml b/git-storage/Cargo.toml index c01b080..6af3f9f 100644 --- a/git-storage/Cargo.toml +++ b/git-storage/Cargo.toml @@ -13,7 +13,7 @@ thiserror = "1" either = "1.8.0" [dependencies.git2] -version = "0.15.0" +version = "0.16.1" default-features = false features = ["vendored-libgit2"] @@ -21,7 +21,7 @@ features = ["vendored-libgit2"] path = "../git-ref-format" [dependencies.libgit2-sys] -version = ">= 0.12.24" +version = ">= 0.14.2" default-features = false features = ["vendored"] diff --git a/git-storage/src/backend/write.rs b/git-storage/src/backend/write.rs index b2d7354..84e01c1 100644 --- a/git-storage/src/backend/write.rs +++ b/git-storage/src/backend/write.rs @@ -540,10 +540,10 @@ impl odb::Write for Write { self.as_raw().blob(data).map(Oid::from) } - fn write_commit<'b>( + fn write_commit( &self, tree: &odb::Tree, - parents: &[&odb::Commit<'b>], + parents: &[&odb::Commit<'_>], message: &str, ) -> Result { let author = self.info.signature()?; diff --git a/git-storage/src/odb/write.rs b/git-storage/src/odb/write.rs index 67d9d01..1988f9a 100644 --- a/git-storage/src/odb/write.rs +++ b/git-storage/src/odb/write.rs @@ -36,10 +36,10 @@ pub trait Write: Read { /// The commit will not be associated with any reference. If this is /// required then you can use the [`Oid`] as the target for a /// [`crate::refdb::Update`]. - fn write_commit<'a>( + fn write_commit( &self, tree: &Tree, - parents: &[&Commit<'a>], + parents: &[&Commit<'_>], message: &str, ) -> Result; diff --git a/git-storage/t/Cargo.toml b/git-storage/t/Cargo.toml index 3f4c777..134b6c0 100644 --- a/git-storage/t/Cargo.toml +++ b/git-storage/t/Cargo.toml @@ -21,7 +21,7 @@ proptest = "1" path = ".." [dependencies.git2] -version = "0.15.0" +version = "0.16.1" default-features = false features = ["vendored-libgit2"] diff --git a/git-storage/t/src/tmp.rs b/git-storage/t/src/tmp.rs index cd16102..825a98c 100644 --- a/git-storage/t/src/tmp.rs +++ b/git-storage/t/src/tmp.rs @@ -8,7 +8,7 @@ pub type TmpRepo = WithTmpDir; pub fn writer(user: UserInfo) -> TmpWriter { WithTmpDir::new(|path| { Write::open(path, user) - .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, format!("{}", e))) + .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string())) }) .unwrap() } diff --git a/link-git/Cargo.toml b/link-git/Cargo.toml index 7e1ca0b..a564ab9 100644 --- a/link-git/Cargo.toml +++ b/link-git/Cargo.toml @@ -58,7 +58,7 @@ features = ["async-client"] # compat [dependencies.git2] -version = "0.15.0" +version = "0.16.1" default-features = false features = ["vendored-libgit2"] optional = true diff --git a/link-git/src/protocol/transport.rs b/link-git/src/protocol/transport.rs index 473f2e5..e8a2226 100644 --- a/link-git/src/protocol/transport.rs +++ b/link-git/src/protocol/transport.rs @@ -27,7 +27,7 @@ where W: AsyncWrite + Unpin, { pub fn new(repo: BString, recv: R, send: W) -> Self { - let url = format!("rad://{}", repo); + let url = format!("rad://{repo}"); let inner = Connection::new( recv, send, diff --git a/link-git/src/protocol/upload_pack.rs b/link-git/src/protocol/upload_pack.rs index b5ff69d..56faff4 100644 --- a/link-git/src/protocol/upload_pack.rs +++ b/link-git/src/protocol/upload_pack.rs @@ -147,7 +147,7 @@ where std::env::vars() .filter(|(key, _)| key == "PATH" || key.starts_with("GIT_TRACE")), ) - .env("GIT_PROTOCOL", format!("version={}", protocol_version)) + .env("GIT_PROTOCOL", format!("version={protocol_version}")) .env("GIT_NAMESPACE", namespace) .args([ "-c", diff --git a/link-git/src/protocol/upload_pack/legacy.rs b/link-git/src/protocol/upload_pack/legacy.rs index 0651f18..4f48f7a 100644 --- a/link-git/src/protocol/upload_pack/legacy.rs +++ b/link-git/src/protocol/upload_pack/legacy.rs @@ -64,10 +64,7 @@ where .arg("-c") .arg("uploadpack.hiderefs=refs/") .arg("-c") - .arg(format!( - "uploadpack.hiderefs=!refs/namespaces/{}", - namespace - )); + .arg(format!("uploadpack.hiderefs=!refs/namespaces/{namespace}",)); for r in unhide { cmd.arg("-c") diff --git a/link-git/t/Cargo.toml b/link-git/t/Cargo.toml index 38cf3fb..313f882 100644 --- a/link-git/t/Cargo.toml +++ b/link-git/t/Cargo.toml @@ -22,7 +22,7 @@ futures_ringbuf = "0.3" tempfile = "3.3" [dev-dependencies.git2] -version = "0.15.0" +version = "0.16.1" default-features = false features = ["vendored-libgit2"] diff --git a/nix/sources.json b/nix/sources.json index 53ebb72..e469ca3 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -5,10 +5,10 @@ "homepage": "https://github.com/nmattia/niv", "owner": "nmattia", "repo": "niv", - "rev": "351d8bc316bf901a81885bab5f52687ec8ccab6e", - "sha256": "1yzhz7ihkh6p2sxhp3amqfbmm2yqzaadqqii1xijymvl8alw5rrr", + "rev": "689d0e5539eddd0b0f566aee7bb18629eee7df74", + "sha256": "1rld3lk42l6b01f2gcrhq8qm9vry1awmfl29zmpiqda9dy89vbx0", "type": "tarball", - "url": "https://github.com/nmattia/niv/archive/351d8bc316bf901a81885bab5f52687ec8ccab6e.tar.gz", + "url": "https://github.com/nmattia/niv/archive/689d0e5539eddd0b0f566aee7bb18629eee7df74.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { @@ -29,10 +29,10 @@ "homepage": "", "owner": "oxalica", "repo": "rust-overlay", - "rev": "7da2f6b3a0c32f661cb2864d7fbd1d7e6f0c7543", - "sha256": "1daw246p4aimvx9h3cf034dsyimh9d2ww19v4fx45mcmlqw1mx42", + "rev": "7093dfcd21df83026ee20426af80bf2072e2da92", + "sha256": "0qp84wa1imc0cij7hv5y8wy04z0nh9d444k1wabdli3prcqq3pvx", "type": "tarball", - "url": "https://github.com/oxalica/rust-overlay/archive/7da2f6b3a0c32f661cb2864d7fbd1d7e6f0c7543.tar.gz", + "url": "https://github.com/oxalica/rust-overlay/archive/7093dfcd21df83026ee20426af80bf2072e2da92.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } diff --git a/radicle-git-ext/Cargo.toml b/radicle-git-ext/Cargo.toml index 6a12882..6bc48e4 100644 --- a/radicle-git-ext/Cargo.toml +++ b/radicle-git-ext/Cargo.toml @@ -19,7 +19,7 @@ percent-encoding = "2" thiserror = "1" [dependencies.git2] -version = "0.15.0" +version = "0.16.1" default-features = false features = ["vendored-libgit2"] diff --git a/radicle-git-ext/src/reference/name.rs b/radicle-git-ext/src/reference/name.rs index 1eded4e..7d58c55 100644 --- a/radicle-git-ext/src/reference/name.rs +++ b/radicle-git-ext/src/reference/name.rs @@ -340,7 +340,7 @@ impl OneLevel { } pub fn into_qualified(self, category: RefLike) -> Qualified { - Qualified(format!("refs/{}/{}", category, self)) + Qualified(format!("refs/{category}/{self}")) } } @@ -454,7 +454,7 @@ impl From for Qualified { if path.starts_with("refs/") { Self(path) } else { - Self(format!("refs/heads/{}", path)) + Self(format!("refs/heads/{path}")) } } } diff --git a/radicle-git-ext/t/Cargo.toml b/radicle-git-ext/t/Cargo.toml index a747d21..ecb297b 100644 --- a/radicle-git-ext/t/Cargo.toml +++ b/radicle-git-ext/t/Cargo.toml @@ -24,7 +24,7 @@ serde = "1" serde_json = "1" [dependencies.git2] -version = "0.15.0" +version = "0.16.1" default-features = false features = ["vendored-libgit2"] diff --git a/radicle-git-types/Cargo.toml b/radicle-git-types/Cargo.toml index 1befa1e..23db4ec 100644 --- a/radicle-git-types/Cargo.toml +++ b/radicle-git-types/Cargo.toml @@ -17,7 +17,7 @@ thiserror = "1.0.30" tracing = "0.1" [dependencies.git2] -version = "0.15.0" +version = "0.16.1" default-features = false features = ["vendored-libgit2"] diff --git a/radicle-git-types/src/reference.rs b/radicle-git-types/src/reference.rs index 1b4dcb7..0bb9500 100644 --- a/radicle-git-types/src/reference.rs +++ b/radicle-git-types/src/reference.rs @@ -535,7 +535,7 @@ impl SymbolicRef { let source = Into::::into(&self.source); let target = Into::::into(&self.target); - let reflog_msg = &format!("creating symbolic ref {} -> {}", source, target); + let reflog_msg = &format!("creating symbolic ref {source} -> {target}"); tracing::debug!("{}", reflog_msg); let _ = repo.refname_to_id(target.as_str())?; diff --git a/radicle-git-types/src/refspec.rs b/radicle-git-types/src/refspec.rs index 69248db..5f4cd48 100644 --- a/radicle-git-types/src/refspec.rs +++ b/radicle-git-types/src/refspec.rs @@ -62,7 +62,7 @@ where let src = Into::::into(&self.src); let dst = Into::::into(&self.dst); - write!(f, "{}:{}", src, dst) + write!(f, "{src}:{dst}") } } diff --git a/radicle-surf/Cargo.toml b/radicle-surf/Cargo.toml index f240586..6c7048e 100644 --- a/radicle-surf/Cargo.toml +++ b/radicle-surf/Cargo.toml @@ -33,7 +33,7 @@ nonempty = "0.5" thiserror = "1.0" [dependencies.git2] -version = "0.15.0" +version = "0.16.1" default-features = false features = ["vendored-libgit2"] diff --git a/radicle-surf/build.rs b/radicle-surf/build.rs index 8d1711d..6cefd73 100644 --- a/radicle-surf/build.rs +++ b/radicle-surf/build.rs @@ -60,7 +60,7 @@ fn main() { unpack(git_platinum_tarball, target).expect("Failed to unpack git-platinum"); - println!("cargo:rerun-if-changed={}", git_platinum_tarball); + println!("cargo:rerun-if-changed={git_platinum_tarball}"); } fn unpack(archive_path: impl AsRef, target: impl AsRef) -> anyhow::Result<()> { diff --git a/radicle-surf/examples/browsing.rs b/radicle-surf/examples/browsing.rs index faead9b..3df8c5a 100644 --- a/radicle-surf/examples/browsing.rs +++ b/radicle-surf/examples/browsing.rs @@ -45,7 +45,7 @@ fn main() { print_directory(&root, &repo, 0); let elapsed_millis = now.elapsed().as_millis(); - println!("browse with print: {} ms", elapsed_millis); + println!("browse with print: {elapsed_millis} ms"); } fn print_directory(d: &Directory, repo: &Repository, indent_level: usize) { diff --git a/radicle-surf/examples/diff.rs b/radicle-surf/examples/diff.rs index c15f7b2..36ba923 100644 --- a/radicle-surf/examples/diff.rs +++ b/radicle-surf/examples/diff.rs @@ -40,7 +40,7 @@ fn get_options_or_exit() -> Options { match Options::parse(std::env::args()) { Ok(options) => options, Err(message) => { - println!("{}", message); + println!("{message}"); std::process::exit(1); }, } @@ -50,7 +50,7 @@ fn init_repository_or_exit(path_to_repo: &str) -> Repository { match Repository::open(path_to_repo) { Ok(repo) => repo, Err(e) => { - println!("Failed to create repository: {:?}", e); + println!("Failed to create repository: {e:?}"); std::process::exit(1); }, } @@ -74,7 +74,7 @@ fn print_diff_summary(diff: &Diff, elapsed_nanos: u128) { diff.modified.len(), diff.added.len() + diff.deleted.len() + diff.modified.len() ); - println!("diff took {} nanos ", elapsed_nanos); + println!("diff took {elapsed_nanos} nanos "); } struct Options { diff --git a/radicle-surf/src/fs.rs b/radicle-surf/src/fs.rs index e260021..e03518d 100644 --- a/radicle-surf/src/fs.rs +++ b/radicle-surf/src/fs.rs @@ -91,9 +91,7 @@ impl File { pub(crate) fn new(name: String, prefix: PathBuf, id: Oid) -> Self { debug_assert!( !prefix.ends_with(&name), - "prefix = {:?}, name = {}", - prefix, - name + "prefix = {prefix:?}, name = {name}", ); Self { name, prefix, id } } @@ -307,9 +305,7 @@ impl Directory { pub(crate) fn new(name: String, prefix: PathBuf, id: Oid) -> Self { debug_assert!( name.is_empty() || !prefix.ends_with(&name), - "prefix = {:?}, name = {}", - prefix, - name + "prefix = {prefix:?}, name = {name}", ); Self { name, prefix, id } } diff --git a/radicle-surf/t/Cargo.toml b/radicle-surf/t/Cargo.toml index c3d86f9..11c475b 100644 --- a/radicle-surf/t/Cargo.toml +++ b/radicle-surf/t/Cargo.toml @@ -19,7 +19,7 @@ proptest = "1" serde_json = "1" [dev-dependencies.git2] -version = "0.15.0" +version = "0.16.1" default-features = false features = ["vendored-libgit2"]