change edition to 2021, fix clippy warns

This commit is contained in:
klensy 2023-06-21 12:43:14 +03:00
parent e1c3313d38
commit fd1439ed8b
7 changed files with 11 additions and 11 deletions

View File

@ -2,7 +2,7 @@
authors = ["The Rust Project Developers"]
name = "installer"
version = "0.0.0"
edition = "2018"
edition = "2021"
[[bin]]
doc = false

View File

@ -94,7 +94,7 @@ impl Combiner {
let pkg_name =
input_tarball.trim_end_matches(&format!(".tar.{}", compression.extension()));
let pkg_name = Path::new(pkg_name).file_name().unwrap();
let pkg_dir = Path::new(&self.work_dir).join(&pkg_name);
let pkg_dir = Path::new(&self.work_dir).join(pkg_name);
// Verify the version number.
let mut version = String::new();
@ -114,9 +114,9 @@ impl Combiner {
// All we need to do is copy the component directory. We could
// move it, but rustbuild wants to reuse the unpacked package
// dir for OS-specific installers on macOS and Windows.
let component_dir = package_dir.join(&component);
let component_dir = package_dir.join(component);
create_dir(&component_dir)?;
copy_recursive(&pkg_dir.join(&component), &component_dir)?;
copy_recursive(&pkg_dir.join(component), &component_dir)?;
// Merge the component name.
writeln!(&components, "{}", component).context("failed to write new components")?;
@ -158,7 +158,7 @@ impl Combiner {
.input(self.package_name)
.output(path_to_str(&output)?.into())
.compression_profile(self.compression_profile)
.compression_formats(self.compression_formats.clone());
.compression_formats(self.compression_formats);
tarballer.run()?;
Ok(())

View File

@ -166,7 +166,7 @@ impl Default for CompressionFormats {
impl CompressionFormats {
pub(crate) fn iter(&self) -> impl Iterator<Item = CompressionFormat> + '_ {
self.0.iter().map(|i| *i)
self.0.iter().copied()
}
}

View File

@ -118,7 +118,7 @@ impl Generator {
.input(self.package_name)
.output(path_to_str(&output)?.into())
.compression_profile(self.compression_profile)
.compression_formats(self.compression_formats.clone());
.compression_formats(self.compression_formats);
tarballer.run()?;
Ok(())

View File

@ -2,7 +2,7 @@ use crate::util::*;
use anyhow::{Context, Result};
use std::io::Write;
const TEMPLATE: &'static str = include_str!("../install-template.sh");
const TEMPLATE: &str = include_str!("../install-template.sh");
actor! {
#[derive(Debug)]

View File

@ -98,7 +98,7 @@ fn append_path<W: Write>(builder: &mut Builder<W>, src: &Path, path: &String) ->
if cfg!(windows) {
// Windows doesn't really have a mode, so `tar` never marks files executable.
// Use an extension whitelist to update files that usually should be so.
const EXECUTABLES: [&'static str; 4] = ["exe", "dll", "py", "sh"];
const EXECUTABLES: [&str; 4] = ["exe", "dll", "py", "sh"];
if let Some(ext) = src.extension().and_then(|s| s.to_str()) {
if EXECUTABLES.contains(&ext) {
let mode = header.mode()?;
@ -134,7 +134,7 @@ where
for entry in WalkDir::new(root.join(name)) {
let entry = entry?;
let path = entry.path().strip_prefix(root)?;
let path = path_to_str(&path)?;
let path = path_to_str(path)?;
if entry.file_type().is_dir() {
dirs.push(path.to_owned());

View File

@ -117,7 +117,7 @@ where
} else {
copy(entry.path(), dst)?;
}
callback(&path, file_type)?;
callback(path, file_type)?;
}
Ok(())
}