From eee0fe751e723f5b8ae039457fdf07a0de07ef6e Mon Sep 17 00:00:00 2001 From: eatradish Date: Mon, 16 Oct 2023 17:13:55 +0800 Subject: [PATCH] style: run cargo clippy and cargo fmt to lint code --- Cargo.toml | 1 - src/actions/mod.rs | 3 ++- src/actions/onboarding.rs | 4 ++-- src/actions/packaging.rs | 2 +- src/common.rs | 10 +++++++++- src/dbus_machine1.rs | 2 +- src/main.rs | 4 +++- src/network.rs | 3 ++- 8 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3f1ed0e..6e5a92a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,6 @@ description = "An nspawn container manager" license = "MIT" authors = ["liushuyu "] repository = "https://github.com/AOSC-Dev/ciel-rs" -home = "https://github.com/AOSC-Dev/ciel-rs" resolver = "2" edition = "2018" diff --git a/src/actions/mod.rs b/src/actions/mod.rs index 88312ce..97772ed 100644 --- a/src/actions/mod.rs +++ b/src/actions/mod.rs @@ -19,8 +19,9 @@ const DEFAULT_MOUNTS: &[(&str, &str)] = &[ ]; const UPDATE_SCRIPT: &str = r#"export DEBIAN_FRONTEND=noninteractive;apt-get update -y --allow-releaseinfo-change && apt-get -y -o Dpkg::Options::="--force-confnew" full-upgrade --autoremove --purge && apt clean"#; +type MountOptions = (Vec, Vec<(String, &'static str)>); /// Ensure that the directories exist and mounted -pub fn ensure_host_sanity() -> Result<(Vec, Vec<(String, &'static str)>), std::io::Error> { +pub fn ensure_host_sanity() -> Result { use crate::warn; let mut extra_options = Vec::new(); diff --git a/src/actions/onboarding.rs b/src/actions/onboarding.rs index 0cb962a..bbe0d07 100644 --- a/src/actions/onboarding.rs +++ b/src/actions/onboarding.rs @@ -107,7 +107,7 @@ pub fn onboarding(custom_tarball: Option<&String>, arch: Option<&str>) -> Result #[inline] fn auto_pick_rootfs( theme: &dyn dialoguer::theme::Theme, - arch: &str + arch: &str, ) -> Result<(String, Option, bool)> { let root = pick_latest_rootfs(arch); @@ -119,7 +119,7 @@ fn auto_pick_rootfs( Ok(( format!("https://releases.aosc.io/{}", rootfs.path), Some(rootfs.sha256sum), - false + false, )) } else { warn!( diff --git a/src/actions/packaging.rs b/src/actions/packaging.rs index 4a4014e..095df75 100644 --- a/src/actions/packaging.rs +++ b/src/actions/packaging.rs @@ -286,7 +286,7 @@ pub fn package_build, K: Clone + ExactSizeIterator>( if !conf.local_repo { let mut cmd = vec!["/bin/acbs-build".to_string(), "--".to_string()]; - cmd.extend(packages.into_iter()); + cmd.extend(packages); let status = run_in_container(instance, &cmd)?; return Ok(status); } diff --git a/src/common.rs b/src/common.rs index 1b770ba..c9547ec 100644 --- a/src/common.rs +++ b/src/common.rs @@ -13,7 +13,15 @@ use std::{ time::Duration, }; -pub const CIEL_MAINLINE_ARCHS: &[&str] = &["amd64", "arm64", "ppc64el", "mips64r6el", "riscv64", "loongarch64", "loongson3"]; +pub const CIEL_MAINLINE_ARCHS: &[&str] = &[ + "amd64", + "arm64", + "ppc64el", + "mips64r6el", + "riscv64", + "loongarch64", + "loongson3", +]; pub const CIEL_RETRO_ARCHS: &[&str] = &["armv4", "armv6hf", "armv7hf", "i486", "m68k", "powerpc"]; pub const CURRENT_CIEL_VERSION: usize = 3; const CURRENT_CIEL_VERSION_STR: &str = "3"; diff --git a/src/dbus_machine1.rs b/src/dbus_machine1.rs index a468a29..1699e7a 100644 --- a/src/dbus_machine1.rs +++ b/src/dbus_machine1.rs @@ -20,7 +20,7 @@ //! …consequently `zbus-xmlgen` did not generate code for the above interfaces. #![allow(clippy::too_many_arguments)] - +#![allow(clippy::type_complexity)] use zbus::dbus_proxy; #[dbus_proxy( diff --git a/src/main.rs b/src/main.rs index 47ecba0..f9f8685 100644 --- a/src/main.rs +++ b/src/main.rs @@ -180,7 +180,9 @@ fn main() -> Result<()> { error!("{:?} is not a file", url); process::exit(1); } - print_error!({ common::extract_system_rootfs(tarball, tarball.metadata()?.len(), use_tarball) }); + print_error!({ + common::extract_system_rootfs(tarball, tarball.metadata()?.len(), use_tarball) + }); return Ok(()); } diff --git a/src/network.rs b/src/network.rs index 0d8009d..186ecc4 100644 --- a/src/network.rs +++ b/src/network.rs @@ -87,7 +87,8 @@ pub fn pick_latest_rootfs(arch: &str) -> Result { .find(|v| v.name == "BuildKit") .ok_or_else(|| anyhow!("Unable to find buildkit variant"))?; - let mut rootfs: Vec = buildkit.squashfs + let mut rootfs: Vec = buildkit + .squashfs .into_iter() .filter(|rootfs| rootfs.arch == arch) .collect();