From 9be0f98f71fe8071ab839ac1036b4064ac3172b4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 29 Jun 2026 00:03:00 +0900 Subject: chore(lint): ban bare `use anyhow::Result` and fully qualify it Add a no_banned_use linter that forbids importing anyhow::Result, and update all call sites to reference it via its fully-qualified path so it is never confused with std::result::Result. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/repository/repository_set.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'crates/shirabe/src/repository/repository_set.rs') diff --git a/crates/shirabe/src/repository/repository_set.rs b/crates/shirabe/src/repository/repository_set.rs index c19f61a..b858151 100644 --- a/crates/shirabe/src/repository/repository_set.rs +++ b/crates/shirabe/src/repository/repository_set.rs @@ -20,7 +20,6 @@ use crate::repository::InstalledRepository; use crate::repository::LockArrayRepositoryHandle; use crate::repository::PlatformRepository; use crate::repository::{FindPackageConstraint, RepositoryInterfaceHandle}; -use anyhow::Result; use indexmap::IndexMap; use shirabe_php_shim::{LogicException, RuntimeException, ksort, strtolower}; use shirabe_semver::constraint::AnyConstraint; @@ -161,7 +160,7 @@ impl RepositorySet { /// repository the search for that package ends, and following repos will not be consulted. /// /// @param RepositoryInterface $repo A package repository - pub fn add_repository(&mut self, repo: RepositoryInterfaceHandle) -> Result<()> { + pub fn add_repository(&mut self, repo: RepositoryInterfaceHandle) -> anyhow::Result<()> { if self.locked { return Err(RuntimeException { message: "Pool has already been created from this repository set, it cannot be modified anymore.".to_string(), @@ -276,7 +275,7 @@ impl RepositorySet { package_names: Vec, allow_partial_advisories: bool, ignore_unreachable: bool, - ) -> Result { + ) -> anyhow::Result { let mut map: IndexMap = IndexMap::new(); for name in &package_names { map.insert(name.clone(), MatchAllConstraint::new(None).into()); @@ -303,7 +302,7 @@ impl RepositorySet { packages: Vec, allow_partial_advisories: bool, ignore_unreachable: bool, - ) -> Result { + ) -> anyhow::Result { let mut map: IndexMap = IndexMap::new(); for package in packages { // ignore root alias versions as they are not actual package versions and should not matter when it comes to vulnerabilities @@ -363,10 +362,10 @@ impl RepositorySet { allow_partial_advisories: bool, ignore_unreachable: bool, unreachable_repos: &mut Vec, - ) -> Result>> { + ) -> anyhow::Result>> { let mut repo_advisories: Vec>> = vec![]; for repository in &self.repositories { - let attempt: Result<()> = (|| -> Result<()> { + let attempt: anyhow::Result<()> = (|| -> anyhow::Result<()> { let mut repo_ref = repository.borrow_mut(); let Some(advisory_repo) = repo_ref.as_advisory_provider_mut() else { return Ok(()); @@ -455,7 +454,7 @@ impl RepositorySet { ignored_types: Vec, allowed_types: Option>, security_advisory_pool_filter: Option, - ) -> Result { + ) -> anyhow::Result { let root_aliases = self .root_aliases .iter() @@ -511,7 +510,7 @@ impl RepositorySet { } /// Create a pool for dependency resolution from the packages in this repository set. - pub fn create_pool_with_all_packages(&mut self) -> Result { + pub fn create_pool_with_all_packages(&mut self) -> anyhow::Result { for repo in &self.repositories { let is_installed = { let repo_ref = repo.borrow(); @@ -581,7 +580,7 @@ impl RepositorySet { &mut self, package_name: &str, locked_repo: Option, - ) -> Result { + ) -> anyhow::Result { // TODO unify this with above in some simpler version without "request"? self.create_pool_for_packages(vec![package_name.to_string()], locked_repo) } @@ -591,7 +590,7 @@ impl RepositorySet { &mut self, package_names: Vec, locked_repo: Option, - ) -> Result { + ) -> anyhow::Result { let mut request = Request::new(locked_repo); let mut allowed_packages: Vec = vec![]; -- cgit v1.3.1