diff options
| author | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-31 02:42:52 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-05-31 17:19:20 +0800 |
| commit | 2aa7bda3cb21ce6c052b82e08bcab79a625d04f2 (patch) | |
| tree | f10b89007fc67ca1a948f34abe6869b49296b932 /examples/example-argument-parse/src/main.rs | |
| parent | 3aa409a55e4f2f0ab41b0949cc06eb13c2da4a43 (diff) | |
Enhance code quality across the entire codebase
Diffstat (limited to 'examples/example-argument-parse/src/main.rs')
| -rw-r--r-- | examples/example-argument-parse/src/main.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/example-argument-parse/src/main.rs b/examples/example-argument-parse/src/main.rs index f63fdad..316e52f 100644 --- a/examples/example-argument-parse/src/main.rs +++ b/examples/example-argument-parse/src/main.rs @@ -39,7 +39,7 @@ fn handle_transfer_parse(args: EntryTransfer) -> Next { // Name // ^^^^_ finally, pick positional arg .pick::<String>(()) - .after(|str| str.trim().replace(" ", "")) + .after(|str| str.trim().replace(' ', "")) // Unpack to tuple (is_dir, size, name) .unpack() // Convert into ResultFile @@ -60,7 +60,7 @@ fn handle_strict_transfer_parse(args: EntryStrictTransfer) -> Next { .pick_or::<usize>("--size", 1024 * 1024_usize) // Finally parse the positional argument; if not found, route to `ErrorNoNameProvided` .pick_or_route::<String, _>((), ErrorNoNameProvided::default().to_chain()) - .after(|str| str.trim().replace(" ", "")) + .after(|str| str.trim().replace(' ', "")) .unpack() } // Convert into ResultFile @@ -69,6 +69,7 @@ fn handle_strict_transfer_parse(args: EntryStrictTransfer) -> Next { result.to_chain() } +/// Renders the parsed transfer result (file/dir, size, name). #[renderer] fn render_result_file(result: ResultFile) { let (is_dir, size, name) = result.into(); @@ -80,6 +81,7 @@ fn render_result_file(result: ResultFile) { ) } +/// Renders the error when no name is provided. #[renderer] fn render_error_no_name_provided(_: ErrorNoNameProvided) { r_println!("Error: name is not provided") |
