From 99c122d219002a638624c7c580c946a5b0be904a Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 9 Jun 2022 15:55:41 -0400 Subject: [PATCH 1/3] rust: Switch to 2021 edition No real changes. ``` $ cargo fix --edition note: Switching to Edition 2021 will enable the use of the version 2 feature resolver in Cargo. This may cause some dependencies to be built with fewer features enabled than previously. More information about the resolver changes may be found at https://doc.rust-lang.org/nightly/edition-guide/rust-2021/default-cargo-resolver.html When building the following dependencies, the given features will no longer be used: libc v0.2.126 removed features: extra_traits The following differences only apply when building with dev-dependencies: getrandom v0.2.6 removed features: std ``` which looks OK to me. --- Cargo.toml | 2 +- rust-bindings/sys/Cargo.toml | 2 +- tests/inst/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0489bc5f..68b3d2bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Felix Krull"] description = "Rust bindings for libostree" documentation = "https://docs.rs/ostree" -edition = "2018" +edition = "2021" keywords = ["ostree", "libostree"] license = "MIT" name = "ostree" diff --git a/rust-bindings/sys/Cargo.toml b/rust-bindings/sys/Cargo.toml index fd453454..5145ab87 100644 --- a/rust-bindings/sys/Cargo.toml +++ b/rust-bindings/sys/Cargo.toml @@ -73,7 +73,7 @@ links = "ostree-1" name = "ostree-sys" repository = "https://github.com/ostreedev/ostree-rs" version = "0.10.0" -edition = "2018" +edition = "2021" [package.metadata.docs.rs] features = ["dox"] [package.metadata.system-deps.ostree_1] diff --git a/tests/inst/Cargo.toml b/tests/inst/Cargo.toml index cf9c2dcc..cd3515b5 100644 --- a/tests/inst/Cargo.toml +++ b/tests/inst/Cargo.toml @@ -2,7 +2,7 @@ name = "ostree-test" version = "0.1.0" authors = ["Colin Walters "] -edition = "2018" +edition = "2021" [workspace] From 76071a2b1184e5e7db7dc8b2e6971eb8313868d3 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 9 Jun 2022 17:49:18 -0400 Subject: [PATCH 2/3] ci: Bump MSRV To match what's in ostree-rs-ext. --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a830c0e8..b9c972e2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,7 +15,7 @@ env: # TODO: Automatically query this from the C side LATEST_LIBOSTREE: "v2022_5" # Minimum supported Rust version (MSRV) - ACTION_MSRV_TOOLCHAIN: 1.54.0 + ACTION_MSRV_TOOLCHAIN: 1.58.1 # Pinned toolchain for linting ACTION_LINTS_TOOLCHAIN: 1.56.0 From 93e3784b66f53d568cf50831b21dc5652c6b80a6 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 9 Jun 2022 17:51:07 -0400 Subject: [PATCH 3/3] rust: Use inline `format!` variables in a few places Since our MSRV now supports it. --- rust-bindings/src/object_name.rs | 2 +- tests/inst/src/destructive.rs | 4 ++-- tests/inst/src/treegen.rs | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rust-bindings/src/object_name.rs b/rust-bindings/src/object_name.rs index 06ff8045..ed4c1bfe 100644 --- a/rust-bindings/src/object_name.rs +++ b/rust-bindings/src/object_name.rs @@ -86,7 +86,7 @@ mod tests { #[test] fn should_stringify_object_name() { let object_name = ObjectName::new("abcdef123456", ObjectType::DirTree); - let stringified = format!("{}", object_name); + let stringified = format!("{object_name}"); assert_eq!(stringified, "abcdef123456.dirtree"); } diff --git a/tests/inst/src/destructive.rs b/tests/inst/src/destructive.rs index 352ee6d5..6cce4b7a 100644 --- a/tests/inst/src/destructive.rs +++ b/tests/inst/src/destructive.rs @@ -363,7 +363,7 @@ fn impl_transaction_test>( booted: booted_commit.to_string(), orig: sysrepo_obj.resolve_rev(ORIGREF, false)?.unwrap().into(), prev: srvrepo_obj - .resolve_rev(&format!("{}^", TESTREF), false)? + .resolve_rev(&format!("{TESTREF}^"), false)? .unwrap() .into(), target: srvrepo_obj.resolve_rev(TESTREF, false)?.unwrap().into(), @@ -568,7 +568,7 @@ pub(crate) fn itest_transactionality() -> Result<()> { ..Default::default() }; with_webserver_in(&srvrepo, &webserver_opts, move |addr| { - let url = format!("http://{}", addr); + let url = format!("http://{addr}"); bash!( "ostree remote delete --if-exists testrepo ostree remote add --set=gpg-verify=false testrepo ${url}", diff --git a/tests/inst/src/treegen.rs b/tests/inst/src/treegen.rs index b6a3a704..29bdffd2 100644 --- a/tests/inst/src/treegen.rs +++ b/tests/inst/src/treegen.rs @@ -31,9 +31,9 @@ pub(crate) fn mkvroot>(p: P, v: u32) -> Result<()> { std::fs::create_dir_all(p.join(v))?; } let verpath = p.join("etc/.mkrootversion"); - write_file(&verpath, &format!("{}", v))?; - write_file(p.join("usr/bin/somebinary"), &format!("somebinary v{}", v))?; - write_file(p.join("etc/someconf"), &format!("someconf v{}", v))?; + write_file(&verpath, &format!("{v}"))?; + write_file(p.join("usr/bin/somebinary"), &format!("somebinary v{v}"))?; + write_file(p.join("etc/someconf"), &format!("someconf v{v}"))?; write_file(p.join("usr/bin/vmod2"), &format!("somebinary v{}", v % 2))?; write_file(p.join("usr/bin/vmod3"), &format!("somebinary v{}", v % 3))?; Ok(()) @@ -134,7 +134,7 @@ pub(crate) fn update_os_tree>( tempdir.ensure_dir(v, 0o755)?; let dest = tempdir.sub_dir(v)?; mutated += mutate_executables_to(&src, &dest, percentage) - .with_context(|| format!("Replacing binaries in {}", v))?; + .with_context(|| format!("Replacing binaries in {v}"))?; } } }