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/command/package_discovery_trait.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'crates/shirabe/src/command/package_discovery_trait.rs') diff --git a/crates/shirabe/src/command/package_discovery_trait.rs b/crates/shirabe/src/command/package_discovery_trait.rs index c3f744c..475b67d 100644 --- a/crates/shirabe/src/command/package_discovery_trait.rs +++ b/crates/shirabe/src/command/package_discovery_trait.rs @@ -17,7 +17,6 @@ use crate::repository::RepositoryFactory; use crate::repository::RepositorySet; use crate::repository::{RepositoryInterface, SearchResult}; use crate::util::Filesystem; -use anyhow::Result; use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; use shirabe_external_packages::symfony::console::input::InputInterface; @@ -104,7 +103,7 @@ pub trait PackageDiscoveryTrait: BaseCommand { &input .borrow() .get_option("stability") - .expect("get_minimum_stability returns String, not Result; stability option is guaranteed present by the has_option guard above") + .expect("get_minimum_stability returns String, not anyhow::Result; stability option is guaranteed present by the has_option guard above") .as_string() .map(|s| s.to_string()) .unwrap_or_else(|| "stable".to_string()), @@ -139,7 +138,7 @@ pub trait PackageDiscoveryTrait: BaseCommand { preferred_stability: &str, use_best_version_constraint: bool, fixed: bool, - ) -> Result> { + ) -> anyhow::Result> { if !requires.is_empty() { let requires_norm = self.normalize_requirements(requires.clone())?; let mut result: Vec = vec![]; @@ -462,7 +461,7 @@ pub trait PackageDiscoveryTrait: BaseCommand { platform_repo: Option<&PlatformRepositoryHandle>, preferred_stability: &str, fixed: bool, - ) -> Result<(String, String)> { + ) -> anyhow::Result<(String, String)> { // handle ignore-platform-reqs flag if present let platform_requirement_filter = if input.borrow().has_option("ignore-platform-reqs") && input.borrow().has_option("ignore-platform-req") @@ -751,8 +750,8 @@ pub trait PackageDiscoveryTrait: BaseCommand { } /// @return array - fn find_similar(&self, package: &str) -> Result> { - let results: Vec = match (|| -> Result> { + fn find_similar(&self, package: &str) -> anyhow::Result> { + let results: Vec = match (|| -> anyhow::Result> { if self.get_repos_mut().is_none() { return Err(LogicException { message: "findSimilar was called before $this->repos was initialized" -- cgit v1.3.1