Skip to content

Commit

Permalink
style: run cargo clippy and cargo fmt to lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
eatradish committed Oct 16, 2023
1 parent 6a5bad8 commit eee0fe7
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 9 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ description = "An nspawn container manager"
license = "MIT"
authors = ["liushuyu <[email protected]>"]
repository = "https://github.com/AOSC-Dev/ciel-rs"
home = "https://github.com/AOSC-Dev/ciel-rs"
resolver = "2"
edition = "2018"

Expand Down
3 changes: 2 additions & 1 deletion src/actions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>, Vec<(String, &'static str)>);
/// Ensure that the directories exist and mounted
pub fn ensure_host_sanity() -> Result<(Vec<String>, Vec<(String, &'static str)>), std::io::Error> {
pub fn ensure_host_sanity() -> Result<MountOptions, std::io::Error> {
use crate::warn;

let mut extra_options = Vec::new();
Expand Down
4 changes: 2 additions & 2 deletions src/actions/onboarding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>, bool)> {
let root = pick_latest_rootfs(arch);

Expand All @@ -119,7 +119,7 @@ fn auto_pick_rootfs(
Ok((
format!("https://releases.aosc.io/{}", rootfs.path),
Some(rootfs.sha256sum),
false
false,
))
} else {
warn!(
Expand Down
2 changes: 1 addition & 1 deletion src/actions/packaging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ pub fn package_build<S: AsRef<str>, K: Clone + ExactSizeIterator<Item = S>>(

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);
}
Expand Down
10 changes: 9 additions & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/dbus_machine1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 3 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(());
}
Expand Down
3 changes: 2 additions & 1 deletion src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ pub fn pick_latest_rootfs(arch: &str) -> Result<RootFs> {
.find(|v| v.name == "BuildKit")
.ok_or_else(|| anyhow!("Unable to find buildkit variant"))?;

let mut rootfs: Vec<RootFs> = buildkit.squashfs
let mut rootfs: Vec<RootFs> = buildkit
.squashfs
.into_iter()
.filter(|rootfs| rootfs.arch == arch)
.collect();
Expand Down

0 comments on commit eee0fe7

Please sign in to comment.