8000 Miscellaneous Code Cleanups by TheLostLambda · Pull Request #915 · aerynOS/os-tools · GitHub
[go: up one dir, main page]

Skip to content
8000
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/checkout@v7

- name: Check for typos
uses: crate-ci/typos@v1.48.0
uses: crate-ci/typos@v1.52.2

- name: Check REUSE compliance
uses: fsfe/reuse-action@v6.0.0
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ inefficient_to_string = "warn"
macro_use_imports = "warn"
map_flatten = "warn"
missing_enforced_import_renames = "warn"
mod_module_files = "warn"
mut_mut = "warn"
nonstandard_macro_braces = "warn"
semicolon_if_nothing_returned = "warn"
Expand Down
2 changes: 2 additions & 0 deletions boulder/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ pub enum Subcommand {
Version(version::Command),
}

// TODO: Box errors consistently throughout the codebase so that this can be removed
#[expect(clippy::result_large_err)]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I would just allow this via workspace.lints.clippy. Probably not that big of a deal.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that could be reasonable, though perhaps it's worth seeing what some others think here? @ermo and @tarkah ?

I'm often hesitant to allow lints for a whole project, but I could be talked into it here, probably.

pub fn process() -> Result<(), Error> {
let args = replace_aliases(std::env::args());
let Command { global, subcommand } = Command::parse_from(args.clone());
Expand Down
4 changes: 4 additions & 0 deletions boulder/src/cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ pub struct Command {
verify_against: Option<PathBuf>,
}

// TODO: Box errors consistently throughout the codebase so that this can be removed
#[expect(clippy::result_large_err)]
pub fn handle(command: Command, env: Env) -> Result<(), Error> {
let output = command.output.clone();
let Command {
Expand Down Expand Up @@ -172,6 +174,8 @@ pub fn handle(command: Command, env: Env) -> Result<(), Error> {
Ok(())
}

// TODO: Box errors consistently throughout the codebase so that this can be removed
#[expect(clippy::result_large_err)]
fn verify_versions_match(builder: &Builder) -> Result<(), Error> {
// Only check the first upstream, as that'll be the actual version
// in the majority of cases.
Expand Down
2 changes: 2 additions & 0 deletions boulder/src/cli/chroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ pub struct Command {
recipe: PathBuf,
}

// TODO: Box errors consistently throughout the codebase so that this can be removed
#[expect(clippy::result_large_err)]
pub fn handle(command: Command, env: Env) -> Result<(), Error> {
let Command { recipe: recipe_path } = command;

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ mod test {
#[test]
fn read_bash_completion() {
let mut stone =
read_bytes(include_bytes!("../../../../test/bash-completion-2.11-1-1-x86_64.stone")).expect("valid stone");
read_bytes(include_bytes!("../../../test/bash-completion-2.11-1-1-x86_64.stone")).expect("valid stone");
assert_eq!(stone.header.version(), StoneHeaderVersion::V1);

let payloads = stone
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion crates/vfs/src/tree/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl<T: BlitFile> TreeBuilder<T> {
}
}

// Chain all directories, replace implicits with explicit
// Chain all directories, replace implicit directories with explicit ones
let all_dirs = dirs
.into_iter()
.chain(self.implicit_dirs.into_values())
Expand Down
8 changes: 8 additions & 0 deletions moss/src/cli/inspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub struct Command {

impl Command {
/// Inspect the given .stone files and print results
// TODO: Box errors consistently throughout the codebase so that this can be removed
#[expect(clippy::result_large_err)]
pub fn handle(self) -> Result<(), Error> {
if self.check {
handle_check(self.paths, self.quiet)
Expand All @@ -40,6 +42,8 @@ impl Command {

const COLUMN_WIDTH: usize = 20;

// TODO: Box errors consistently throughout the codebase so that this can be removed
#[expect(clippy::result_large_err)]
fn handle_check(paths: Vec<PathBuf>, quiet: bool) -> Result<(), Error> {
let mut had_error = false;
for path in paths {
Expand Down Expand Up @@ -72,6 +76,8 @@ fn handle_check(paths: Vec<PathBuf>, quiet: bool) -> Result<(), Error> {
}
}

// TODO: Box errors consistently throughout the codebase so that this can be removed
#[expect(clippy::result_large_err)]
fn handle_detailed(paths: Vec<PathBuf>) -> Result<(), Error> {
// Process each input path in order.
for path in paths {
Expand Down Expand Up @@ -175,6 +181,8 @@ fn handle_detailed(paths: Vec<PathBuf>) -> Result<(), Error> {

/// Checks the integrity of a single .stone file by reading all payloads
/// and validating their checksums from any readable source.
// TODO: Box errors consistently throughout the codebase so that this can be removed
#[expect(clippy::result_large_err)]
fn check_stone_integrity(mut source: impl Read + Seek) -> Result<Vec<String>, Error> {
let mut reader = stone::read(&mut source)?;
let mut found_payloads = Vec::new();
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion moss/src/db/layout/mod.rs → moss/src/db/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use types::{Layout, encode_file};

mod types;

const SCHEMAS: &[&str] = &[include_str!("schemas/v1_up.sql")];
const SCHEMAS: &[&str] = &[include_str!("layout/schemas/v1_up.sql")];
const MIGRATIONS: Migrations = Migrations::new(SCHEMAS);

#[derive(Clone, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion moss/src/db/meta/mod.rs → moss/src/db/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub use super::Error;

mod types;

const SCHEMAS: &[&str] = &[include_str!("schemas/v1_up.sql")];
const SCHEMAS: &[&str] = &[include_str!("meta/schemas/v1_up.sql")];
const MIGRATIONS: Migrations = Migrations::new(SCHEMAS);

#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion moss/src/db/state/mod.rs → moss/src/db/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::state::{Id, Kind, Selection, State};

mod types;

const SCHEMAS: &[&str] = &[include_str!("schemas/v1_up.sql")];
const SCHEMAS: &[&str] = &[include_str!("state/schemas/v1_up.sql")];
const MIGRATIONS: Migrations = Migrations::new(SCHEMAS);

#[derive(Clone, Debug)]
Expand Down
File renamed without changes.
< F56D /div>
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# SPDX-License-Identifier: MPL-2.0

[toolchain]
channel = "1.94"
channel = "1.95"
components = ["rust-analyzer", "rustfmt", "clippy"]
0