change edition to 2021, fix clippy warns
This commit is contained in:
parent
e1c3313d38
commit
fd1439ed8b
@ -2,7 +2,7 @@
|
||||
authors = ["The Rust Project Developers"]
|
||||
name = "installer"
|
||||
version = "0.0.0"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
doc = false
|
||||
|
@ -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(())
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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(())
|
||||
|
@ -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)]
|
||||
|
@ -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());
|
||||
|
@ -117,7 +117,7 @@ where
|
||||
} else {
|
||||
copy(entry.path(), dst)?;
|
||||
}
|
||||
callback(&path, file_type)?;
|
||||
callback(path, file_type)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user