From 2b51554ff59d1e5cbf8dd2db65d278b0202a9102 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 27 Jun 2026 03:52:05 +0900 Subject: refactor: fix compiler warnings and clippy warnings --- .../shirabe-class-map-generator/src/class_map_generator.rs | 13 ++++++------- crates/shirabe-class-map-generator/src/php_file_parser.rs | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'crates/shirabe-class-map-generator') 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; - if autoload_type != "classmap" { + let base_path: Option = 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 = 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; -- cgit v1.3.1