diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a70d7cf..16be783 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -44,3 +44,11 @@ jobs: clippy_flags: --workspace --no-deps filter_mode: nofilter github_token: ${{ secrets.GITHUB_TOKEN }} + + typos: + name: Spell Check with Typos + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: crate-ci/typos@v1.28.1 diff --git a/Cargo.lock b/Cargo.lock index a11fb52..0b7e390 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -172,9 +172,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cfg_aliases" -version = "0.1.1" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "clap" @@ -479,9 +479,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ "bitflags", "cfg-if", @@ -540,9 +540,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -675,9 +675,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.68" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -695,18 +695,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.61" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index bbc76fe..1ab7e24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,8 +17,8 @@ members = [ blake3 = { version = "1.5.1", features = ["mmap", "rayon"] } log = "0.4.21" gpt = "3.1.0" -thiserror = "1" -nix = { version = "0.28.0", features = ["fs", "mount"] } +thiserror = "2.0.3" +nix = { version = "0.29.0", features = ["fs", "mount"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" uuid = { version = "1.8.0", features = ["v8"] } diff --git a/blsctl/src/main.rs b/blsctl/src/main.rs index 5e6c47b..baeb0b5 100644 --- a/blsctl/src/main.rs +++ b/blsctl/src/main.rs @@ -150,7 +150,7 @@ fn inspect_root(config: &Configuration) -> color_eyre::Result<()> { if let Some(json) = kernel .extras .iter() - .find(|e| matches!(e.kind, blsforme::AuxilliaryKind::BootJSON)) + .find(|e| matches!(e.kind, blsforme::AuxiliaryKind::BootJSON)) { let text = fs::read_to_string(&json.path)?; let decoded = BootJSON::try_from(text.as_str())?; diff --git a/blsforme/src/bootloader/systemd_boot/mod.rs b/blsforme/src/bootloader/systemd_boot/mod.rs index 3fd2aeb..03f38b1 100644 --- a/blsforme/src/bootloader/systemd_boot/mod.rs +++ b/blsforme/src/bootloader/systemd_boot/mod.rs @@ -22,6 +22,7 @@ pub mod interface; #[derive(Debug)] pub struct Loader<'a, 'b> { /// system configuration + #[allow(dead_code)] config: &'a Configuration, assets: &'b [PathBuf], mounts: &'a Mounts, diff --git a/blsforme/src/entry.rs b/blsforme/src/entry.rs index 8a88056..286c3ed 100644 --- a/blsforme/src/entry.rs +++ b/blsforme/src/entry.rs @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: MPL-2.0 -use crate::{AuxilliaryFile, Kernel, Schema}; +use crate::{AuxiliaryFile, Kernel, Schema}; /// An entry corresponds to a single kernel, and may have a supplemental /// cmdline @@ -11,6 +11,7 @@ pub struct Entry<'a> { pub(crate) kernel: &'a Kernel, // Additional cmdline + #[allow(dead_code)] cmdline: Option, } @@ -54,10 +55,10 @@ impl<'a> Entry<'a> { /// Generate installed asset (aux) name, used by bootloaders /// Right now this only returns CBM style IDs - pub fn installed_asset_name(&self, schema: &Schema, asset: &AuxilliaryFile) -> Option { + pub fn installed_asset_name(&self, schema: &Schema, asset: &AuxiliaryFile) -> Option { match &schema { Schema::Legacy { .. } => match asset.kind { - crate::AuxilliaryKind::InitRD => asset + crate::AuxiliaryKind::InitRD => asset .path .file_name() .map(|f| f.to_string_lossy()) @@ -67,7 +68,7 @@ impl<'a> Entry<'a> { Schema::Blsforme { .. } => { let filename = asset.path.file_name().map(|f| f.to_string_lossy())?; match asset.kind { - crate::AuxilliaryKind::InitRD => Some(format!("{}/{}", &self.kernel.version, filename)), + crate::AuxiliaryKind::InitRD => Some(format!("{}/{}", &self.kernel.version, filename)), _ => None, } } diff --git a/blsforme/src/kernel.rs b/blsforme/src/kernel.rs index f56534c..adbd105 100644 --- a/blsforme/src/kernel.rs +++ b/blsforme/src/kernel.rs @@ -51,7 +51,7 @@ impl<'a> TryFrom<&'a str> for BootJSON<'a> { } /// A kernel is the primary bootable element that we care about, ie -/// the vmlinuz file. It also comes with a set of auxilliary files +/// the vmlinuz file. It also comes with a set of auxiliary files /// that are required for a fully working system, but specifically /// dependent on that kernel version. #[derive(Debug, PartialEq, PartialOrd, Eq, Ord)] @@ -63,18 +63,18 @@ pub struct Kernel { pub image: PathBuf, /// All of the initrds - pub initrd: Vec, + pub initrd: Vec, - /// Any non-initrd, auxillary files - pub extras: Vec, + /// Any non-initrd, auxiliary files + pub extras: Vec, /// Recorded variant type pub variant: Option, } -/// Denotes the kind of auxillary file +/// Denotes the kind of auxiliary file #[derive(Debug, PartialEq, PartialOrd, Eq, Ord)] -pub enum AuxilliaryKind { +pub enum AuxiliaryKind { /// A cmdline snippet Cmdline, @@ -94,12 +94,12 @@ pub enum AuxilliaryKind { /// An additional file required to be shipped with the kernel, /// such as initrds, system maps, etc. #[derive(Debug, PartialEq, PartialOrd, Eq, Ord)] -pub struct AuxilliaryFile { +pub struct AuxiliaryFile { pub path: PathBuf, - pub kind: AuxilliaryKind, + pub kind: AuxiliaryKind, } -impl<'a> Schema<'a> { +impl Schema<'_> { /// Given a set of kernel-like paths, yield all potential kernels within them /// This should be a set of `/usr/lib/kernel` paths. Use glob or appropriate to discover. pub fn discover_system_kernels(&self, paths: impl Iterator>) -> Result, Error> { @@ -181,29 +181,29 @@ impl<'a> Schema<'a> { .ok_or_else(|| Error::InvalidFilesystem)?; let aux = match filename { - x if x == sysmap_file => Some(AuxilliaryFile { + x if x == sysmap_file => Some(AuxiliaryFile { path: path.as_ref().into(), - kind: AuxilliaryKind::SystemMap, + kind: AuxiliaryKind::SystemMap, }), - x if x == cmdline_file => Some(AuxilliaryFile { + x if x == cmdline_file => Some(AuxiliaryFile { path: path.as_ref().into(), - kind: AuxilliaryKind::Cmdline, + kind: AuxiliaryKind::Cmdline, }), - x if x == config_file => Some(AuxilliaryFile { + x if x == config_file => Some(AuxiliaryFile { path: path.as_ref().into(), - kind: AuxilliaryKind::Config, + kind: AuxiliaryKind::Config, }), - x if x == initrd_file => Some(AuxilliaryFile { + x if x == initrd_file => Some(AuxiliaryFile { path: path.as_ref().into(), - kind: AuxilliaryKind::InitRD, + kind: AuxiliaryKind::InitRD, }), x if x.starts_with(&initrd_file) => { // Version dependent initrd if x != initrd_file { if x.split_once(&initrd_file).is_some() { - Some(AuxilliaryFile { + Some(AuxiliaryFile { path: path.as_ref().into(), - kind: AuxilliaryKind::InitRD, + kind: AuxiliaryKind::InitRD, }) } else { None @@ -216,9 +216,9 @@ impl<'a> Schema<'a> { // Version independent initrd if let Some((_, r)) = x.split_once(&indep_initrd) { if !r.contains('.') { - Some(AuxilliaryFile { + Some(AuxiliaryFile { path: path.as_ref().into(), - kind: AuxilliaryKind::InitRD, + kind: AuxiliaryKind::InitRD, }) } else { None @@ -231,7 +231,7 @@ impl<'a> Schema<'a> { }; if let Some(aux_file) = aux { - if matches!(aux_file.kind, AuxilliaryKind::InitRD) { + if matches!(aux_file.kind, AuxiliaryKind::InitRD) { kernel.initrd.push(aux_file); } else { kernel.extras.push(aux_file); @@ -290,31 +290,31 @@ impl<'a> Schema<'a> { .to_str() .ok_or_else(|| Error::InvalidFilesystem)?; let aux = match filename { - "System.map" => Some(AuxilliaryFile { + "System.map" => Some(AuxiliaryFile { path: asset.clone(), - kind: AuxilliaryKind::SystemMap, + kind: AuxiliaryKind::SystemMap, }), - "boot.json" => Some(AuxilliaryFile { + "boot.json" => Some(AuxiliaryFile { path: asset.clone(), - kind: AuxilliaryKind::BootJSON, + kind: AuxiliaryKind::BootJSON, }), - "config" => Some(AuxilliaryFile { + "config" => Some(AuxiliaryFile { path: asset.clone(), - kind: AuxilliaryKind::Config, + kind: AuxiliaryKind::Config, }), - _ if filename.ends_with(".initrd") => Some(AuxilliaryFile { + _ if filename.ends_with(".initrd") => Some(AuxiliaryFile { path: asset.clone(), - kind: AuxilliaryKind::InitRD, + kind: AuxiliaryKind::InitRD, }), - _ if filename.ends_with(".cmdline") => Some(AuxilliaryFile { + _ if filename.ends_with(".cmdline") => Some(AuxiliaryFile { path: asset.clone(), - kind: AuxilliaryKind::Cmdline, + kind: AuxiliaryKind::Cmdline, }), _ => None, }; if let Some(aux_file) = aux { - if matches!(aux_file.kind, AuxilliaryKind::InitRD) { + if matches!(aux_file.kind, AuxiliaryKind::InitRD) { kernel.initrd.push(aux_file); } else { kernel.extras.push(aux_file); diff --git a/blsforme/src/lib.rs b/blsforme/src/lib.rs index fea69fa..dd848c7 100644 --- a/blsforme/src/lib.rs +++ b/blsforme/src/lib.rs @@ -8,7 +8,7 @@ use bootloader::systemd_boot; use thiserror::Error; mod kernel; -pub use kernel::{AuxilliaryFile, AuxilliaryKind, BootJSON, Kernel, Schema}; +pub use kernel::{AuxiliaryFile, AuxiliaryKind, BootJSON, Kernel, Schema}; mod bootenv; pub use bootenv::{BootEnvironment, Firmware}; @@ -57,7 +57,7 @@ pub enum Error { #[error("no ESP mounted in image mode, but detected an ESP at {0}")] UnmountedESP(PathBuf), - #[error("unspported usage")] + #[error("unsupported usage")] Unsupported, } diff --git a/crates/superblock/tests/README.md b/crates/superblock/tests/README.md index 4d8f574..bd31038 100644 --- a/crates/superblock/tests/README.md +++ b/crates/superblock/tests/README.md @@ -22,7 +22,7 @@ test images) ## luks+ext4.img.zst Password : abc - Versio : LUKS2 + Version : LUKS2 LUKS UUID: be373cae-2bd1-4ad5-953f-3463b2e53e59 EXT4 UUID: e27c657e-d03c-4f89-b36d-2de6880bc2a1 @@ -31,4 +31,4 @@ test images) Limited to 12-char volume name UUID : 45e8a3bf-8114-400f-95b0-380d0fb7d42d - LABEL: BLSFORME \ No newline at end of file + LABEL: BLSFORME diff --git a/crates/topology/src/disk/device.rs b/crates/topology/src/disk/device.rs index 2f233fa..bf3d861 100644 --- a/crates/topology/src/disk/device.rs +++ b/crates/topology/src/disk/device.rs @@ -18,7 +18,7 @@ use super::probe; pub struct BlockDevice<'a> { pub kind: Option, - // Actively mounted somwhere? + // Actively mounted somewhere? pub mountpoint: Option, // Generally easier to work with strings in client code @@ -36,7 +36,7 @@ pub struct BlockDevice<'a> { // GPT partition GUID pub(super) guid: Option, - // Auxillary (ignored) device + // Auxiliary (ignored) device pub(super) aux: bool, } diff --git a/crates/topology/src/disk/mounts.rs b/crates/topology/src/disk/mounts.rs index cffd1f8..38293f2 100644 --- a/crates/topology/src/disk/mounts.rs +++ b/crates/topology/src/disk/mounts.rs @@ -32,7 +32,7 @@ pub enum MountOption<'a> { Option(&'a str, &'a str), } -impl<'a> MountOption<'a> { +impl MountOption<'_> { /// Returns true if this is a flag pub fn is_flag(&self) -> bool { match &self { @@ -47,7 +47,7 @@ impl<'a> MountOption<'a> { } } -impl<'a> Mount<'a> { +impl Mount<'_> { /// Convert [`Mount::opts`] into an iterator of typed options pub fn options(&self) -> impl Iterator { self.opts.split(',').map(|o| { diff --git a/crates/topology/src/disk/probe.rs b/crates/topology/src/disk/probe.rs index b64b969..2e4de1e 100644 --- a/crates/topology/src/disk/probe.rs +++ b/crates/topology/src/disk/probe.rs @@ -61,7 +61,7 @@ impl Probe { .mounts .iter() .find(|m| PathBuf::from(m.mountpoint) == mountpoint) - .ok_or_else(|| super::Error::UnknownMount(mountpoint))?; + .ok_or(super::Error::UnknownMount(mountpoint))?; // TODO: Handle `ZFS=`, and composite bcachefs mounts (dev:dev1:dev2) Ok(matching_device.device.into()) }