diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-09-16 21:21:11 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-09-17 21:28:53 +0800 |
| commit | f89fd1db8260d3a74b8ee0c3577761192be186d1 (patch) | |
| tree | f82080a16ce8cbb98b52b09ac9732bca59a0a419 | |
| parent | a3b597ba7efbf7e0ddbe9d72e7202ea7a6b286a9 (diff) | |
chore(task): more idiomatic rust
| -rw-r--r-- | src/tasks.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/tasks.rs b/src/tasks.rs index 1793091..3c49c7a 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -35,10 +35,7 @@ fn exec(cmds: &[String]) -> Result<String, String> { fn network(switch: &[String]) -> Result<String, String> { use std::process::{Command, Stdio}; - let switch: bool = match switch[0].parse() { - Ok(s) => s, - Err(e) => return Err(e.to_string()), - }; + let switch: bool = switch[0].parse::<bool>().map_err(|e| e.to_string())?; // TODO: windows and linux |
