Skip to content

Commit a2e6dc4

Browse files
authored
Merge pull request #941 from cgwalters/drop-unneeded-table-vecs
Minor fixes
2 parents ff0260a + fbe632e commit a2e6dc4

File tree

12 files changed

+19
-20
lines changed

12 files changed

+19
-20
lines changed

lib/src/boundimage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ mod tests {
233233

234234
#[test]
235235
fn test_parse_spec_dir() -> Result<()> {
236-
const CONTAINER_IMAGE_DIR: &'static str = "usr/share/containers/systemd";
236+
const CONTAINER_IMAGE_DIR: &str = "usr/share/containers/systemd";
237237

238238
// Empty dir should return an empty vector
239239
let td = &cap_std_ext::cap_tempfile::TempDir::new(cap_std::ambient_authority())?;

lib/src/cli.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,10 +857,10 @@ async fn edit(opts: EditOpts) -> Result<()> {
857857
async fn usroverlay() -> Result<()> {
858858
// This is just a pass-through today. At some point we may make this a libostree API
859859
// or even oxidize it.
860-
return Err(Command::new("ostree")
860+
Err(Command::new("ostree")
861861
.args(["admin", "unlock"])
862862
.exec()
863-
.into());
863+
.into())
864864
}
865865

866866
/// Perform process global initialization. This should be called as early as possible
@@ -931,7 +931,7 @@ impl Opt {
931931
_ => None,
932932
};
933933
if let Some(base_args) = mapped {
934-
let base_args = base_args.into_iter().map(OsString::from);
934+
let base_args = base_args.iter().map(OsString::from);
935935
return Opt::parse_from(base_args.chain(args.map(|i| i.into())));
936936
}
937937
Some(first)

lib/src/image.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ pub(crate) async fn list_entrypoint(
105105

106106
table
107107
.load_preset(NOTHING)
108-
.set_header(vec!["REPOSITORY", "TYPE"]);
108+
.set_header(["REPOSITORY", "TYPE"]);
109109

110110
for image in images {
111-
table.add_row(vec![image.image, image.image_type.to_string()]);
111+
table.add_row([image.image, image.image_type.to_string()]);
112112
}
113113

114114
println!("{table}");

lib/src/install/completion.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct Renamer<'d> {
8383
to: &'static Utf8Path,
8484
}
8585

86-
impl<'d> Renamer<'d> {
86+
impl Renamer<'_> {
8787
fn _impl_drop(&mut self) -> Result<()> {
8888
self.dir
8989
.rename(self.from, self.dir, self.to)
@@ -95,7 +95,7 @@ impl<'d> Renamer<'d> {
9595
}
9696
}
9797

98-
impl<'d> Drop for Renamer<'d> {
98+
impl Drop for Renamer<'_> {
9999
fn drop(&mut self) {
100100
let _ = self._impl_drop();
101101
}

lib/src/kernel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub(crate) fn find_first_cmdline_arg<'a>(
4040
#[test]
4141
fn test_find_first() {
4242
let kargs = &["foo=bar", "root=/dev/vda", "blah", "root=/dev/other"];
43-
let kargs = || kargs.iter().map(|&s| s);
43+
let kargs = || kargs.iter().copied();
4444
assert_eq!(find_first_cmdline_arg(kargs(), "root"), Some("/dev/vda"));
4545
assert_eq!(find_first_cmdline_arg(kargs(), "nonexistent"), None);
4646
}

lib/src/mount.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub(crate) fn open_tree_from_pidns(
163163
None,
164164
)
165165
.context("socketpair")?;
166-
const DUMMY_DATA: &[u8] = &[b'!'];
166+
const DUMMY_DATA: &[u8] = b"!";
167167
match unsafe { libc::fork() } {
168168
0 => {
169169
// We're in the child. At this point we know we don't have multiple threads, so we

ostree-ext/src/chunking.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,13 +866,12 @@ mod test {
866866
})
867867
.collect();
868868

869-
let image_manifest = oci_spec::image::ImageManifestBuilder::default()
869+
oci_spec::image::ImageManifestBuilder::default()
870870
.schema_version(oci_spec::image::SCHEMA_VERSION)
871871
.config(config)
872872
.layers(layers)
873873
.build()
874-
.expect("build image manifest");
875-
image_manifest
874+
.expect("build image manifest")
876875
}
877876

878877
#[test]

ostree-ext/src/container/encapsulate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ pub struct ExportOpts<'m, 'o> {
392392
pub created: Option<String>,
393393
}
394394

395-
impl<'m, 'o> ExportOpts<'m, 'o> {
395+
impl ExportOpts<'_, '_> {
396396
/// Return the gzip compression level to use, as configured by the export options.
397397
fn compression(&self) -> Compression {
398398
if self.skip_compression {

ostree-ext/src/container/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ impl<'a> ManifestDiff<'a> {
387387
}
388388
}
389389

390-
impl<'a> ManifestDiff<'a> {
390+
impl ManifestDiff<'_> {
391391
/// Prints the total, removed and added content between two OCI images
392392
pub fn print(&self) {
393393
let print_total = self.total;

ostree-ext/src/fixture.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl FileDef {
136136
h.set_mtime(0);
137137
h.set_uid(self.uid.into());
138138
h.set_gid(self.gid.into());
139-
h.set_mode(self.mode.into());
139+
h.set_mode(self.mode);
140140
match &self.ty {
141141
FileDefType::Regular(data) => {
142142
let data = data.as_bytes();

ostree-ext/src/ostree_prepareroot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ enabled = false
184184
for v in ["", d0, d1, d2] {
185185
let kf = glib::KeyFile::new();
186186
kf.load_from_data(v, glib::KeyFileFlags::empty()).unwrap();
187-
assert_eq!(overlayfs_enabled_in_config(&kf).unwrap(), false);
187+
assert!(!overlayfs_enabled_in_config(&kf).unwrap());
188188
}
189189

190190
let e0 = format!("{d0}\n[root]\ntransient = true");
@@ -194,6 +194,6 @@ enabled = false
194194
for v in [e0, e1, e2, e3] {
195195
let kf = glib::KeyFile::new();
196196
kf.load_from_data(&v, glib::KeyFileFlags::empty()).unwrap();
197-
assert_eq!(overlayfs_enabled_in_config(&kf).unwrap(), true);
197+
assert!(overlayfs_enabled_in_config(&kf).unwrap());
198198
}
199199
}

ostree-ext/tests/it/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ async fn impl_test_container_import_export(chunked: bool) -> Result<()> {
518518
.cmd()
519519
.as_ref()
520520
.unwrap()
521-
.get(0)
521+
.first()
522522
.as_ref()
523523
.unwrap()
524524
.as_str(),
@@ -671,7 +671,7 @@ async fn test_export_as_container_derived() -> Result<()> {
671671
let srcpath = src_imgref.name.as_str();
672672
fixture.generate_test_derived_oci(srcpath, Some(&derived_tag))?;
673673
let derived_imgref = ImageReference {
674-
transport: src_imgref.transport.clone(),
674+
transport: src_imgref.transport,
675675
name: format!("{}:{derived_tag}", src_imgref.name.as_str()),
676676
};
677677

0 commit comments

Comments
 (0)