diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-02 01:32:03 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-02 01:34:49 +0900 |
| commit | eab3a31c5750013c53c0eb02adc976d6757dc9f7 (patch) | |
| tree | c84b4bc6243668eb79c00af98e00800c2951077b /crates/shirabe | |
| parent | dda045eb663524b40e277047e3cea301738e5c26 (diff) | |
| download | php-shirabe-eab3a31c5750013c53c0eb02adc976d6757dc9f7.tar.gz php-shirabe-eab3a31c5750013c53c0eb02adc976d6757dc9f7.tar.zst php-shirabe-eab3a31c5750013c53c0eb02adc976d6757dc9f7.zip | |
chore(lint): ban std::io::Read/Write, Any, Command use imports
Extends no_banned_use to cover std::any::Any, std::io::Read/Write, and
std::process::Command, and teaches the linter to allow `as _` imports
so trait methods can still be brought into scope without binding the
banned name. Fully qualifies all existing usages across the codebase.
Diffstat (limited to 'crates/shirabe')
5 files changed, 6 insertions, 11 deletions
diff --git a/crates/shirabe/src/package/archiver/archiver_interface.rs b/crates/shirabe/src/package/archiver/archiver_interface.rs index 54121b5..d50c96a 100644 --- a/crates/shirabe/src/package/archiver/archiver_interface.rs +++ b/crates/shirabe/src/package/archiver/archiver_interface.rs @@ -1,7 +1,5 @@ //! ref: composer/src/Composer/Package/Archiver/ArchiverInterface.php -use std::any::Any; - pub trait ArchiverInterface { fn archive( &self, @@ -15,5 +13,5 @@ pub trait ArchiverInterface { fn supports(&self, format: String, source_type: Option<String>) -> bool; /// PHP `$archiver instanceof X` checks; allow downcasting from `dyn ArchiverInterface`. - fn as_any(&self) -> &dyn Any; + fn as_any(&self) -> &dyn std::any::Any; } diff --git a/crates/shirabe/src/repository/filesystem_repository.rs b/crates/shirabe/src/repository/filesystem_repository.rs index 0e17841..7d59bb0 100644 --- a/crates/shirabe/src/repository/filesystem_repository.rs +++ b/crates/shirabe/src/repository/filesystem_repository.rs @@ -26,7 +26,6 @@ use shirabe_php_shim::{ is_array, is_null, is_string, ksort, realpath, str_repeat, trim, usort, var_export, }; use shirabe_semver::constraint::AnyConstraint; -use std::any::Any; /// Filesystem repository. #[derive(Debug)] @@ -825,7 +824,7 @@ impl RepositoryInterface for FilesystemRepository { self.inner.get_repo_name() } - fn as_any(&self) -> &dyn Any { + fn as_any(&self) -> &dyn std::any::Any { self } diff --git a/crates/shirabe/src/util/http/curl_downloader.rs b/crates/shirabe/src/util/http/curl_downloader.rs index 0d8248b..6a6a1d6 100644 --- a/crates/shirabe/src/util/http/curl_downloader.rs +++ b/crates/shirabe/src/util/http/curl_downloader.rs @@ -632,7 +632,7 @@ impl CurlDownloader { max_file_size: Option<u64>, filename: Option<&str>, ) -> Result<Body, (String, bool)> { - use std::io::{Read, Write}; + use std::io::{Read as _, Write as _}; let mut stream = resp; let mut written: u64 = 0; diff --git a/crates/shirabe/tests/all_functional_test.rs b/crates/shirabe/tests/all_functional_test.rs index 594f064..57788a3 100644 --- a/crates/shirabe/tests/all_functional_test.rs +++ b/crates/shirabe/tests/all_functional_test.rs @@ -12,7 +12,6 @@ use shirabe_external_packages::composer::pcre::preg::Preg; use shirabe_php_shim::{CaptureKey, PREG_SPLIT_DELIM_CAPTURE, PhpMixed, intval}; use std::cell::RefCell; use std::path::{Path, PathBuf}; -use std::process::Command; /// ref: AllFunctionalTest's `$oldcwd` / `$testDir` instance state plus its `setUp`/`tearDown`. /// @@ -213,7 +212,7 @@ fn run_integration(test_filename: &str) { let run = &test_data["RUN"]; let command_line = format!("'{}' --no-ansi {} 2>&1", bin, run); - let proc = Command::new("sh") + let proc = std::process::Command::new("sh") .arg("-c") .arg(&command_line) .current_dir(&test_dir) diff --git a/crates/shirabe/tests/repository/vcs_repository_test.rs b/crates/shirabe/tests/repository/vcs_repository_test.rs index ed705e8..1ee72cb 100644 --- a/crates/shirabe/tests/repository/vcs_repository_test.rs +++ b/crates/shirabe/tests/repository/vcs_repository_test.rs @@ -12,7 +12,6 @@ use shirabe::util::http_downloader::HttpDownloader; use shirabe::util::r#loop::Loop; use shirabe_php_shim::PhpMixed; use std::cell::RefCell; -use std::process::Command; use std::rc::Rc; use tempfile::TempDir; @@ -31,7 +30,7 @@ fn set_up() -> Option<SetUp> { let path = git_repo.path(); let exec = |args: &[&str]| { - let status = Command::new("git") + let status = std::process::Command::new("git") .args(args) .current_dir(path) .env("GIT_CONFIG_GLOBAL", "/dev/null") @@ -129,7 +128,7 @@ fn composer(version: Option<&str>) -> PhpMixed { } fn which_git() -> Option<()> { - Command::new("git") + std::process::Command::new("git") .arg("--version") .output() .ok() |
