summaryrefslogtreecommitdiff
path: root/utils/src/input
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-03-20 22:21:56 +0800
committer魏曹先生 <1992414357@qq.com>2026-03-20 22:21:56 +0800
commitab6be7968b25afb57fc428695693484ad8576718 (patch)
treee4af27964f195a18a678844dbe71c0aaa182b5dc /utils/src/input
parent6b22f7b7694fce530f84ba94c65c057450cca626 (diff)
Refactor code to use modern Rust idioms and fix clippy lints
Diffstat (limited to 'utils/src/input')
-rw-r--r--utils/src/input/editor.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/utils/src/input/editor.rs b/utils/src/input/editor.rs
index aa3e1be..45867e5 100644
--- a/utils/src/input/editor.rs
+++ b/utils/src/input/editor.rs
@@ -30,10 +30,7 @@ pub async fn input_with_editor_cutsom(
let status = Command::new(editor).arg(cache_path).status().await?;
if !status.success() {
- return Err(std::io::Error::new(
- std::io::ErrorKind::Other,
- "Editor exited with non-zero status",
- ));
+ return Err(std::io::Error::other("Editor exited with non-zero status"));
}
// Read the modified content
@@ -42,14 +39,7 @@ pub async fn input_with_editor_cutsom(
// Remove comment lines and trim
let processed_content: String = content
.lines()
- .filter_map(|line| {
- let trimmed = line.trim();
- if trimmed.starts_with(comment_prefix) {
- None
- } else {
- Some(line)
- }
- })
+ .filter(|line| !line.trim().starts_with(comment_prefix))
.collect::<Vec<&str>>()
.join("\n");