diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-29 00:03:00 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-29 00:03:00 +0900 |
| commit | 9be0f98f71fe8071ab839ac1036b4064ac3172b4 (patch) | |
| tree | 66a2f4feba752f4761c40449e0827ad74fc9b02c /crates/shirabe/src/installed_versions.rs | |
| parent | a84d531548efa678d4021cea891826e59f8fb462 (diff) | |
| download | php-shirabe-9be0f98f71fe8071ab839ac1036b4064ac3172b4.tar.gz php-shirabe-9be0f98f71fe8071ab839ac1036b4064ac3172b4.tar.zst php-shirabe-9be0f98f71fe8071ab839ac1036b4064ac3172b4.zip | |
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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/installed_versions.rs')
| -rw-r--r-- | crates/shirabe/src/installed_versions.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/shirabe/src/installed_versions.rs b/crates/shirabe/src/installed_versions.rs index 8b287f1..3cda1c4 100644 --- a/crates/shirabe/src/installed_versions.rs +++ b/crates/shirabe/src/installed_versions.rs @@ -1,7 +1,6 @@ //! ref: composer/src/Composer/InstalledVersions.php use crate::autoload::ClassLoader; -use anyhow::Result; use indexmap::IndexMap; use shirabe_php_shim::{ OutOfBoundsException, PhpMixed, array_flip, array_keys, array_merge, call_user_func_array, @@ -143,7 +142,7 @@ impl InstalledVersions { parser: &VersionParser, package_name: &str, constraint: Option<&str>, - ) -> Result<bool> { + ) -> anyhow::Result<bool> { let constraint = parser.parse_constraints(constraint.unwrap_or(""))?; let provided = parser.parse_constraints(&Self::get_version_ranges(package_name)?)?; @@ -157,7 +156,7 @@ impl InstalledVersions { /// /// @param string $packageName /// @return string Version constraint usable with composer/semver - pub fn get_version_ranges(package_name: &str) -> Result<String> { + pub fn get_version_ranges(package_name: &str) -> anyhow::Result<String> { for installed in Self::get_installed() { let Some(versions) = installed.get("versions").and_then(|v| v.as_array()) else { continue; @@ -226,7 +225,7 @@ impl InstalledVersions { /// @param string $packageName /// @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present - pub fn get_version(package_name: &str) -> Result<Option<String>> { + pub fn get_version(package_name: &str) -> anyhow::Result<Option<String>> { for installed in Self::get_installed() { let Some(versions) = installed.get("versions").and_then(|v| v.as_array()) else { continue; @@ -254,7 +253,7 @@ impl InstalledVersions { /// @param string $packageName /// @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present - pub fn get_pretty_version(package_name: &str) -> Result<Option<String>> { + pub fn get_pretty_version(package_name: &str) -> anyhow::Result<Option<String>> { for installed in Self::get_installed() { let Some(versions) = installed.get("versions").and_then(|v| v.as_array()) else { continue; @@ -282,7 +281,7 @@ impl InstalledVersions { /// @param string $packageName /// @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference - pub fn get_reference(package_name: &str) -> Result<Option<String>> { + pub fn get_reference(package_name: &str) -> anyhow::Result<Option<String>> { for installed in Self::get_installed() { let Some(versions) = installed.get("versions").and_then(|v| v.as_array()) else { continue; @@ -310,7 +309,7 @@ impl InstalledVersions { /// @param string $packageName /// @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. - pub fn get_install_path(package_name: &str) -> Result<Option<String>> { + pub fn get_install_path(package_name: &str) -> anyhow::Result<Option<String>> { for installed in Self::get_installed() { let Some(versions) = installed.get("versions").and_then(|v| v.as_array()) else { continue; |
