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/init_command.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'crates/shirabe/src/command/init_command.rs') diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs index dc91069..856cc78 100644 --- a/crates/shirabe/src/command/init_command.rs +++ b/crates/shirabe/src/command/init_command.rs @@ -17,7 +17,6 @@ use crate::repository::RepositoryFactory; use crate::util::Filesystem; use crate::util::ProcessExecutor; use crate::util::Silencer; -use anyhow::Result; use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; use shirabe_external_packages::symfony::console::command::command::Command; @@ -918,7 +917,10 @@ impl BaseCommand for InitCommand { impl InitCommand { /// @return array{name: string, email: string|null} - fn parse_author_string(&self, author: &str) -> Result>> { + fn parse_author_string( + &self, + author: &str, + ) -> anyhow::Result>> { let mut m: IndexMap = IndexMap::new(); if Preg::is_match3( r#"/^(?P[- .,\p{L}\p{N}\p{Mn}\'’\"()]+)(?:\s+<(?P.+?)>)?$/u"#, @@ -960,7 +962,10 @@ impl InitCommand { } /// @return array - pub(crate) fn format_authors(&self, author: &str) -> Result>> { + pub(crate) fn format_authors( + &self, + author: &str, + ) -> anyhow::Result>> { let parsed = self.parse_author_string(author)?; let mut author_map: IndexMap = IndexMap::new(); let name = parsed.get("name").cloned().unwrap_or(None); @@ -1072,12 +1077,18 @@ impl InitCommand { } /// For testing only: invoke the private `parse_author_string`. - pub fn __parse_author_string(&self, author: &str) -> Result>> { + pub fn __parse_author_string( + &self, + author: &str, + ) -> anyhow::Result>> { self.parse_author_string(author) } /// For testing only: invoke the crate-private `format_authors`. - pub fn __format_authors(&self, author: &str) -> Result>> { + pub fn __format_authors( + &self, + author: &str, + ) -> anyhow::Result>> { self.format_authors(author) } -- cgit v1.3.1