aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-class-map-generator
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-27 03:52:05 +0900
committernsfisis <nsfisis@gmail.com>2026-06-27 04:21:34 +0900
commit2b51554ff59d1e5cbf8dd2db65d278b0202a9102 (patch)
treef4d9b0abf4df9b5e363e3bd65511d70e3d5ada00 /crates/shirabe-class-map-generator
parentcc07b5abb83a40d678401c335bdc49bb81b72c5f (diff)
downloadphp-shirabe-2b51554ff59d1e5cbf8dd2db65d278b0202a9102.tar.gz
php-shirabe-2b51554ff59d1e5cbf8dd2db65d278b0202a9102.tar.zst
php-shirabe-2b51554ff59d1e5cbf8dd2db65d278b0202a9102.zip
refactor: fix compiler warnings and clippy warnings
Diffstat (limited to 'crates/shirabe-class-map-generator')
-rw-r--r--crates/shirabe-class-map-generator/src/class_map_generator.rs13
-rw-r--r--crates/shirabe-class-map-generator/src/php_file_parser.rs2
2 files changed, 7 insertions, 8 deletions
diff --git a/crates/shirabe-class-map-generator/src/class_map_generator.rs b/crates/shirabe-class-map-generator/src/class_map_generator.rs
index f591811..cb49487 100644
--- a/crates/shirabe-class-map-generator/src/class_map_generator.rs
+++ b/crates/shirabe-class-map-generator/src/class_map_generator.rs
@@ -9,8 +9,8 @@ use shirabe_external_packages::symfony::finder::Finder;
use shirabe_php_shim::{
DIRECTORY_SEPARATOR, InvalidArgumentException, LogicException, PATHINFO_EXTENSION, PHP_INT_MAX,
PhpMixed, RuntimeException, explode, getcwd, implode, in_array, is_dir, is_file, is_string,
- pathinfo, preg_quote, realpath, sprintf, str_replace, str_starts_with, stream_get_wrappers,
- strlen, strpos, strrpos, strtr, substr,
+ pathinfo, preg_quote, realpath, str_replace, str_starts_with, stream_get_wrappers, strlen,
+ strpos, strrpos, strtr, substr,
};
use std::path::PathBuf;
@@ -89,8 +89,7 @@ impl ClassMapGenerator {
}));
}
- let base_path: Option<String>;
- if autoload_type != "classmap" {
+ let base_path: Option<String> = if autoload_type != "classmap" {
if !is_string(&path) {
return Err(anyhow::anyhow!(InvalidArgumentException {
message:
@@ -105,10 +104,10 @@ impl ClassMapGenerator {
code: 0,
}));
}
- base_path = path.as_string().map(|s| s.to_string());
+ path.as_string().map(|s| s.to_string())
} else {
- base_path = None;
- }
+ None
+ };
let files: Vec<PathBuf> = if is_string(&path) {
let path_str = path.as_string().unwrap_or("");
diff --git a/crates/shirabe-class-map-generator/src/php_file_parser.rs b/crates/shirabe-class-map-generator/src/php_file_parser.rs
index 7d7c722..8d64dbd 100644
--- a/crates/shirabe-class-map-generator/src/php_file_parser.rs
+++ b/crates/shirabe-class-map-generator/src/php_file_parser.rs
@@ -6,7 +6,7 @@ use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
HHVM_VERSION, PHP_EOL, PHP_VERSION_ID, RuntimeException, error_get_last, file_exists,
- file_get_contents, function_exists, is_file, is_readable, ltrim, php_strip_whitespace, sprintf,
+ file_get_contents, function_exists, is_file, is_readable, ltrim, php_strip_whitespace,
str_replace_array, strrpos, substr, trim, version_compare,
};
use std::sync::OnceLock;