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) --- .../src/repository/writable_array_repository.rs | 29 +++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'crates/shirabe/src/repository/writable_array_repository.rs') diff --git a/crates/shirabe/src/repository/writable_array_repository.rs b/crates/shirabe/src/repository/writable_array_repository.rs index c4b31aa..e415a1e 100644 --- a/crates/shirabe/src/repository/writable_array_repository.rs +++ b/crates/shirabe/src/repository/writable_array_repository.rs @@ -7,7 +7,6 @@ use crate::repository::ArrayRepository; use crate::repository::RepositoryInterface; use crate::repository::RepositoryInterfaceWeakHandle; use crate::repository::{FindPackageConstraint, LoadPackagesResult, ProviderInfo, SearchResult}; -use anyhow::Result; use indexmap::IndexMap; use shirabe_semver::constraint::AnyConstraint; @@ -19,7 +18,7 @@ pub struct WritableArrayRepository { } impl WritableArrayRepository { - pub fn new(packages: Vec) -> Result { + pub fn new(packages: Vec) -> anyhow::Result { Ok(Self { inner: ArrayRepository::new(packages)?, dev_package_names: Vec::new(), @@ -44,7 +43,7 @@ impl WritableArrayRepository { &mut self, dev_mode: bool, _installation_manager: &InstallationManager, - ) -> Result<()> { + ) -> anyhow::Result<()> { self.dev_mode = Some(dev_mode); Ok(()) } @@ -61,7 +60,10 @@ impl WritableArrayRepository { self.inner.is_initialized() } - pub fn add_package(&mut self, package: crate::package::PackageInterfaceHandle) -> Result<()> { + pub fn add_package( + &mut self, + package: crate::package::PackageInterfaceHandle, + ) -> anyhow::Result<()> { self.inner.add_package(package) } @@ -72,12 +74,12 @@ impl WritableArrayRepository { pub fn remove_package( &mut self, package: crate::package::PackageInterfaceHandle, - ) -> Result<()> { + ) -> anyhow::Result<()> { self.inner.remove_package(package); Ok(()) } - pub fn initialize(&mut self) -> Result<()> { + pub fn initialize(&mut self) -> anyhow::Result<()> { self.inner.initialize(); Ok(()) } @@ -134,7 +136,7 @@ impl RepositoryInterface for WritableArrayRepository { &mut self, name: &str, constraint: FindPackageConstraint, - ) -> Result> { + ) -> anyhow::Result> { self.inner.find_package(name, constraint) } @@ -142,11 +144,11 @@ impl RepositoryInterface for WritableArrayRepository { &mut self, name: &str, constraint: Option, - ) -> Result> { + ) -> anyhow::Result> { self.inner.find_packages(name, constraint) } - fn get_packages(&mut self) -> Result> { + fn get_packages(&mut self) -> anyhow::Result> { self.inner.get_packages() } @@ -156,7 +158,7 @@ impl RepositoryInterface for WritableArrayRepository { acceptable_stabilities: IndexMap, stability_flags: IndexMap, already_loaded: IndexMap>, - ) -> Result { + ) -> anyhow::Result { self.inner.load_packages( package_name_map, acceptable_stabilities, @@ -170,11 +172,14 @@ impl RepositoryInterface for WritableArrayRepository { query: String, mode: i64, r#type: Option, - ) -> Result> { + ) -> anyhow::Result> { self.inner.search(query, mode, r#type) } - fn get_providers(&mut self, package_name: String) -> Result> { + fn get_providers( + &mut self, + package_name: String, + ) -> anyhow::Result> { self.inner.get_providers(package_name) } -- cgit v1.3.1