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/config.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'crates/shirabe/src/config.rs') diff --git a/crates/shirabe/src/config.rs b/crates/shirabe/src/config.rs index 7b4ce89..cac6181 100644 --- a/crates/shirabe/src/config.rs +++ b/crates/shirabe/src/config.rs @@ -7,7 +7,6 @@ pub use config_source_interface::*; pub use json_config_source::*; use crate::io::io_interface; -use anyhow::Result; use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; use shirabe_php_shim::{ @@ -573,7 +572,7 @@ impl Config { } /// Typed convenience accessor for keys whose `get()` value is always a string. - pub fn get_str(&self, key: &str) -> Result { + pub fn get_str(&self, key: &str) -> anyhow::Result { Ok(self .get_with_flags(key, 0)? .as_string() @@ -581,7 +580,7 @@ impl Config { .to_string()) } - pub fn get_with_flags(&self, key: &str, flags: i64) -> Result { + pub fn get_with_flags(&self, key: &str, flags: i64) -> anyhow::Result { match key { // strings/paths with env var and {$refs} support "vendor-dir" | "bin-dir" | "process-timeout" | "data-dir" | "cache-dir" @@ -972,7 +971,7 @@ impl Config { } /// @return array - pub fn all(&mut self, flags: i64) -> Result> { + pub fn all(&mut self, flags: i64) -> anyhow::Result> { let mut all: IndexMap = IndexMap::new(); all.insert( "repositories".to_string(), @@ -1040,7 +1039,7 @@ impl Config { /// @param int $flags Options (see class constants) /// /// @return string|mixed - fn process(&self, value: PhpMixed, flags: i64) -> Result { + fn process(&self, value: PhpMixed, flags: i64) -> anyhow::Result { if !is_string(&value) { return Ok(value); } @@ -1115,7 +1114,7 @@ impl Config { url: &str, io: Option>>, repo_options: &IndexMap, - ) -> Result<()> { + ) -> anyhow::Result<()> { // Return right away if the URL is malformed or custom (see issue #5173), but only for non-HTTP(S) URLs if !filter_var_url(url) && !Preg::is_match(r"{^https?://}", url) { return Ok(()); -- cgit v1.3.1