diff --git a/Cargo.lock b/Cargo.lock index 69a49f0..0255ccc 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 = "aho-corasick" @@ -423,9 +423,9 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" dependencies = [ "either", ] diff --git a/Cargo.toml b/Cargo.toml index dbb6fa0..68f8bfd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "codeowners" version = "0.2.3" -edition = "2021" +edition = "2024" [profile.release] debug = true @@ -16,7 +16,7 @@ error-stack = "0.5.0" enum_dispatch = "0.3.13" fast-glob = "0.4.0" ignore = "0.4.23" -itertools = "0.13.0" +itertools = "0.14.0" lazy_static = "1.5.0" path-clean = "1.0.1" rayon = "1.10.0" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 6b1db70..bbf93c3 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.83.0" +channel = "1.85.0" components = ["clippy", "rustfmt"] targets = ["x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-unknown-linux-gnu"] diff --git a/src/cli.rs b/src/cli.rs index f680b2d..508c7b8 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,6 +1,6 @@ use clap::{Parser, Subcommand}; use codeowners::{ - cache::{file::GlobalCache, noop::NoopCache, Cache, Caching}, + cache::{Cache, Caching, file::GlobalCache, noop::NoopCache}, config::Config, ownership::{FileOwner, Ownership}, project_builder::ProjectBuilder, diff --git a/src/common_test.rs b/src/common_test.rs index 0d86004..6deb5d3 100644 --- a/src/common_test.rs +++ b/src/common_test.rs @@ -11,7 +11,7 @@ pub mod tests { use tempfile::tempdir; use crate::{ - cache::{noop::NoopCache, Cache}, + cache::{Cache, noop::NoopCache}, config::Config, ownership::Ownership, project_builder::ProjectBuilder, diff --git a/src/ownership.rs b/src/ownership.rs index fc296cc..0c28afe 100644 --- a/src/ownership.rs +++ b/src/ownership.rs @@ -99,11 +99,7 @@ pub struct Entry { impl Entry { fn to_row(&self) -> String { let line = format!("/{} {}", self.path, self.github_team); - if self.disabled { - format!("# {}", line) - } else { - line - } + if self.disabled { format!("# {}", line) } else { line } } } @@ -379,8 +375,10 @@ mod tests { "}; let team_ownership = parse_for_team("@Foo".to_string(), codeownership_file); - assert!(team_ownership - .is_err_and(|e| e.to_string() == "CODEOWNERS out of date. Run `codeowners generate` to update the CODEOWNERS file")); + assert!( + team_ownership + .is_err_and(|e| e.to_string() == "CODEOWNERS out of date. Run `codeowners generate` to update the CODEOWNERS file") + ); Ok(()) } @@ -392,8 +390,10 @@ mod tests { "}; let team_ownership = parse_for_team("@Foo".to_string(), codeownership_file); - assert!(team_ownership - .is_err_and(|e| e.to_string() == "CODEOWNERS out of date. Run `codeowners generate` to update the CODEOWNERS file")); + assert!( + team_ownership + .is_err_and(|e| e.to_string() == "CODEOWNERS out of date. Run `codeowners generate` to update the CODEOWNERS file") + ); Ok(()) } diff --git a/src/ownership/file_owner_finder.rs b/src/ownership/file_owner_finder.rs index 502294a..e89de74 100644 --- a/src/ownership/file_owner_finder.rs +++ b/src/ownership/file_owner_finder.rs @@ -57,7 +57,7 @@ impl<'a> DirectoryOverrider<'a> { fn process(&mut self, team_name: &'a TeamName, source: &'a Source) { if self .specific_directory_owner - .map_or(true, |(_, current_source)| current_source.len() < source.len()) + .is_none_or(|(_, current_source)| current_source.len() < source.len()) { self.specific_directory_owner = Some((team_name, source)); } diff --git a/src/ownership/mapper.rs b/src/ownership/mapper.rs index 5c4e24d..62f64a4 100644 --- a/src/ownership/mapper.rs +++ b/src/ownership/mapper.rs @@ -80,7 +80,7 @@ impl OwnerMatcher { (None, source) } } - OwnerMatcher::ExactMatches(ref path_to_team, source) => (path_to_team.get(relative_path), source), + OwnerMatcher::ExactMatches(path_to_team, source) => (path_to_team.get(relative_path), source), } } } diff --git a/src/ownership/mapper/team_file_mapper.rs b/src/ownership/mapper/team_file_mapper.rs index 67df9e4..96cf8d2 100644 --- a/src/ownership/mapper/team_file_mapper.rs +++ b/src/ownership/mapper/team_file_mapper.rs @@ -2,8 +2,8 @@ use std::collections::HashMap; use std::path::PathBuf; use std::sync::Arc; -use super::escaper::escape_brackets; use super::Entry; +use super::escaper::escape_brackets; use super::{Mapper, OwnerMatcher}; use crate::ownership::mapper::Source; use crate::project::Project; diff --git a/src/project_builder.rs b/src/project_builder.rs index c99b07c..9d92ab8 100644 --- a/src/project_builder.rs +++ b/src/project_builder.rs @@ -12,7 +12,7 @@ use tracing::instrument; use crate::{ cache::Cache, config::Config, - project::{deserializers, DirectoryCodeownersFile, Error, Package, PackageType, Project, ProjectFile, Team, VendoredGem}, + project::{DirectoryCodeownersFile, Error, Package, PackageType, Project, ProjectFile, Team, VendoredGem, deserializers}, project_file_builder::ProjectFileBuilder, }; diff --git a/src/project_file_builder.rs b/src/project_file_builder.rs index 0b49acd..5ac06df 100644 --- a/src/project_file_builder.rs +++ b/src/project_file_builder.rs @@ -54,7 +54,7 @@ fn build_project_file_without_cache(path: &PathBuf) -> ProjectFile { return ProjectFile { path: path.clone(), owner: None, - } + }; } };