diff options
-rw-r--r-- | crates/ra_cli/src/help.rs | 48 | ||||
-rw-r--r-- | crates/ra_cli/src/main.rs | 138 | ||||
-rw-r--r-- | crates/ra_tools/src/help.rs | 27 | ||||
-rw-r--r-- | crates/ra_tools/src/main.rs | 64 |
4 files changed, 116 insertions, 161 deletions
diff --git a/crates/ra_cli/src/help.rs b/crates/ra_cli/src/help.rs index bf31472ac..5171578f0 100644 --- a/crates/ra_cli/src/help.rs +++ b/crates/ra_cli/src/help.rs | |||
@@ -1,6 +1,4 @@ | |||
1 | pub fn print_global_help() { | 1 | pub const GLOBAL_HELP: &str = "ra-cli |
2 | println!( | ||
3 | "ra-cli | ||
4 | 2 | ||
5 | USAGE: | 3 | USAGE: |
6 | ra_cli <SUBCOMMAND> | 4 | ra_cli <SUBCOMMAND> |
@@ -13,13 +11,9 @@ SUBCOMMANDS: | |||
13 | analysis-stats | 11 | analysis-stats |
14 | highlight | 12 | highlight |
15 | parse | 13 | parse |
16 | symbols" | 14 | symbols"; |
17 | ) | ||
18 | } | ||
19 | 15 | ||
20 | pub fn print_analysis_bench_help() { | 16 | pub const ANALYSIS_BENCH_HELP: &str = "ra_cli-analysis-bench |
21 | println!( | ||
22 | "ra_cli-analysis-bench | ||
23 | 17 | ||
24 | USAGE: | 18 | USAGE: |
25 | ra_cli analysis-bench [FLAGS] [OPTIONS] [PATH] | 19 | ra_cli analysis-bench [FLAGS] [OPTIONS] [PATH] |
@@ -33,13 +27,9 @@ OPTIONS: | |||
33 | --highlight <PATH> Hightlight this file | 27 | --highlight <PATH> Hightlight this file |
34 | 28 | ||
35 | ARGS: | 29 | ARGS: |
36 | <PATH> Project to analyse" | 30 | <PATH> Project to analyse"; |
37 | ) | ||
38 | } | ||
39 | 31 | ||
40 | pub fn print_analysis_stats_help() { | 32 | pub const ANALYSIS_STATS_HELP: &str = "ra-cli-analysis-stats |
41 | println!( | ||
42 | "ra-cli-analysis-stats | ||
43 | 33 | ||
44 | USAGE: | 34 | USAGE: |
45 | ra_cli analysis-stats [FLAGS] [OPTIONS] [PATH] | 35 | ra_cli analysis-stats [FLAGS] [OPTIONS] [PATH] |
@@ -53,44 +43,30 @@ OPTIONS: | |||
53 | -o <ONLY> | 43 | -o <ONLY> |
54 | 44 | ||
55 | ARGS: | 45 | ARGS: |
56 | <PATH>" | 46 | <PATH>"; |
57 | ) | ||
58 | } | ||
59 | 47 | ||
60 | pub fn print_highlight_help() { | 48 | pub const HIGHLIGHT_HELP: &str = "ra-cli-highlight |
61 | println!( | ||
62 | "ra-cli-highlight | ||
63 | 49 | ||
64 | USAGE: | 50 | USAGE: |
65 | ra_cli highlight [FLAGS] | 51 | ra_cli highlight [FLAGS] |
66 | 52 | ||
67 | FLAGS: | 53 | FLAGS: |
68 | -h, --help Prints help information | 54 | -h, --help Prints help information |
69 | -r, --rainbow" | 55 | -r, --rainbow"; |
70 | ) | ||
71 | } | ||
72 | 56 | ||
73 | pub fn print_symbols_help() { | 57 | pub const SYMBOLS_HELP: &str = "ra-cli-symbols |
74 | println!( | ||
75 | "ra-cli-symbols | ||
76 | 58 | ||
77 | USAGE: | 59 | USAGE: |
78 | ra_cli highlight [FLAGS] | 60 | ra_cli highlight [FLAGS] |
79 | 61 | ||
80 | FLAGS: | 62 | FLAGS: |
81 | -h, --help Prints help inforamtion" | 63 | -h, --help Prints help inforamtion"; |
82 | ) | ||
83 | } | ||
84 | 64 | ||
85 | pub fn print_parse_help() { | 65 | pub const PARSE_HELP: &str = "ra-cli-parse |
86 | println!( | ||
87 | "ra-cli-parse | ||
88 | 66 | ||
89 | USAGE: | 67 | USAGE: |
90 | ra_cli parse [FLAGS] | 68 | ra_cli parse [FLAGS] |
91 | 69 | ||
92 | FLAGS: | 70 | FLAGS: |
93 | -h, --help Prints help inforamtion | 71 | -h, --help Prints help inforamtion |
94 | --no-dump" | 72 | --no-dump"; |
95 | ) | ||
96 | } | ||
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs index a9a9fbddd..e6334cf56 100644 --- a/crates/ra_cli/src/main.rs +++ b/crates/ra_cli/src/main.rs | |||
@@ -15,105 +15,101 @@ type Result<T> = std::result::Result<T, Box<dyn Error + Send + Sync>>; | |||
15 | fn main() -> Result<()> { | 15 | fn main() -> Result<()> { |
16 | Logger::with_env().start()?; | 16 | Logger::with_env().start()?; |
17 | 17 | ||
18 | let subcommand = std::env::args_os().nth(1); | 18 | let subcommand = match std::env::args_os().nth(1) { |
19 | if subcommand.is_none() { | 19 | None => { |
20 | help::print_global_help(); | 20 | eprintln!("{}", help::GLOBAL_HELP); |
21 | return Ok(()); | 21 | return Ok(()); |
22 | } | 22 | } |
23 | let subcommand = subcommand.unwrap(); | 23 | Some(s) => s, |
24 | }; | ||
24 | let mut matches = Arguments::from_vec(std::env::args_os().skip(2).collect()); | 25 | let mut matches = Arguments::from_vec(std::env::args_os().skip(2).collect()); |
25 | 26 | ||
26 | match &*subcommand.to_string_lossy() { | 27 | match &*subcommand.to_string_lossy() { |
27 | "parse" => { | 28 | "parse" => { |
28 | if matches.contains(["-h", "--help"]) { | 29 | if matches.contains(["-h", "--help"]) { |
29 | help::print_parse_help(); | 30 | eprintln!("{}", help::PARSE_HELP); |
30 | return Ok(()); | 31 | return Ok(()); |
31 | } else { | 32 | } |
32 | let no_dump = matches.contains("--no-dump"); | 33 | let no_dump = matches.contains("--no-dump"); |
33 | matches.finish().or_else(handle_extra_flags)?; | 34 | matches.finish().or_else(handle_extra_flags)?; |
34 | 35 | ||
35 | let _p = profile("parsing"); | 36 | let _p = profile("parsing"); |
36 | let file = file()?; | 37 | let file = file()?; |
37 | if !no_dump { | 38 | if !no_dump { |
38 | println!("{:#?}", file.syntax()); | 39 | println!("{:#?}", file.syntax()); |
39 | } | ||
40 | std::mem::forget(file); | ||
41 | } | 40 | } |
41 | std::mem::forget(file); | ||
42 | } | 42 | } |
43 | "symbols" => { | 43 | "symbols" => { |
44 | if matches.contains(["-h", "--help"]) { | 44 | if matches.contains(["-h", "--help"]) { |
45 | help::print_symbols_help(); | 45 | eprintln!("{}", help::SYMBOLS_HELP); |
46 | return Ok(()); | 46 | return Ok(()); |
47 | } else { | 47 | } |
48 | matches.finish().or_else(handle_extra_flags)?; | 48 | matches.finish().or_else(handle_extra_flags)?; |
49 | let file = file()?; | 49 | let file = file()?; |
50 | for s in file_structure(&file) { | 50 | for s in file_structure(&file) { |
51 | println!("{:?}", s); | 51 | println!("{:?}", s); |
52 | } | ||
53 | } | 52 | } |
54 | } | 53 | } |
55 | "highlight" => { | 54 | "highlight" => { |
56 | if matches.contains(["-h", "--help"]) { | 55 | if matches.contains(["-h", "--help"]) { |
57 | help::print_highlight_help(); | 56 | eprintln!("{}", help::HIGHLIGHT_HELP); |
58 | return Ok(()); | 57 | return Ok(()); |
59 | } else { | ||
60 | let rainbow_opt = matches.contains(["-r", "--rainbow"]); | ||
61 | matches.finish().or_else(handle_extra_flags)?; | ||
62 | let (analysis, file_id) = Analysis::from_single_file(read_stdin()?); | ||
63 | let html = analysis.highlight_as_html(file_id, rainbow_opt).unwrap(); | ||
64 | println!("{}", html); | ||
65 | } | 58 | } |
59 | let rainbow_opt = matches.contains(["-r", "--rainbow"]); | ||
60 | matches.finish().or_else(handle_extra_flags)?; | ||
61 | let (analysis, file_id) = Analysis::from_single_file(read_stdin()?); | ||
62 | let html = analysis.highlight_as_html(file_id, rainbow_opt).unwrap(); | ||
63 | println!("{}", html); | ||
66 | } | 64 | } |
67 | "analysis-stats" => { | 65 | "analysis-stats" => { |
68 | if matches.contains(["-h", "--help"]) { | 66 | if matches.contains(["-h", "--help"]) { |
69 | help::print_analysis_stats_help(); | 67 | eprintln!("{}", help::ANALYSIS_STATS_HELP); |
70 | return Ok(()); | 68 | return Ok(()); |
71 | } else { | ||
72 | let verbose = matches.contains(["-v", "--verbose"]); | ||
73 | let memory_usage = matches.contains("--memory-usage"); | ||
74 | let path = matches.value_from_str("--path")?.unwrap_or("".to_string()); | ||
75 | let only = matches.value_from_str(["-o", "--only"])?.map(|v: String| v.to_owned()); | ||
76 | matches.finish().or_else(handle_extra_flags)?; | ||
77 | analysis_stats::run( | ||
78 | verbose, | ||
79 | memory_usage, | ||
80 | path.as_ref(), | ||
81 | only.as_ref().map(String::as_ref), | ||
82 | )?; | ||
83 | } | 69 | } |
70 | let verbose = matches.contains(["-v", "--verbose"]); | ||
71 | let memory_usage = matches.contains("--memory-usage"); | ||
72 | let path: String = matches.value_from_str("--path")?.unwrap_or_default(); | ||
73 | let only = matches.value_from_str(["-o", "--only"])?.map(|v: String| v.to_owned()); | ||
74 | matches.finish().or_else(handle_extra_flags)?; | ||
75 | analysis_stats::run( | ||
76 | verbose, | ||
77 | memory_usage, | ||
78 | path.as_ref(), | ||
79 | only.as_ref().map(String::as_ref), | ||
80 | )?; | ||
84 | } | 81 | } |
85 | "analysis-bench" => { | 82 | "analysis-bench" => { |
86 | if matches.contains(["-h", "--help"]) { | 83 | if matches.contains(["-h", "--help"]) { |
87 | help::print_analysis_bench_help(); | 84 | eprintln!("{}", help::ANALYSIS_BENCH_HELP); |
88 | return Ok(()); | 85 | return Ok(()); |
89 | } else { | ||
90 | let verbose = matches.contains(["-v", "--verbose"]); | ||
91 | let path = matches.value_from_str("--path")?.unwrap_or("".to_string()); | ||
92 | let highlight_path = matches.value_from_str("--highlight")?; | ||
93 | let complete_path = matches.value_from_str("--complete")?; | ||
94 | if highlight_path.is_some() && complete_path.is_some() { | ||
95 | panic!("either --highlight or --complete must be set, not both") | ||
96 | } | ||
97 | let op = if let Some(path) = highlight_path { | ||
98 | let path: String = path; | ||
99 | analysis_bench::Op::Highlight { path: path.into() } | ||
100 | } else if let Some(path_line_col) = complete_path { | ||
101 | let path_line_col: String = path_line_col; | ||
102 | let (path_line, column) = rsplit_at_char(path_line_col.as_str(), ':')?; | ||
103 | let (path, line) = rsplit_at_char(path_line, ':')?; | ||
104 | analysis_bench::Op::Complete { | ||
105 | path: path.into(), | ||
106 | line: line.parse()?, | ||
107 | column: column.parse()?, | ||
108 | } | ||
109 | } else { | ||
110 | panic!("either --highlight or --complete must be set") | ||
111 | }; | ||
112 | matches.finish().or_else(handle_extra_flags)?; | ||
113 | analysis_bench::run(verbose, path.as_ref(), op)?; | ||
114 | } | 86 | } |
87 | let verbose = matches.contains(["-v", "--verbose"]); | ||
88 | let path: String = matches.value_from_str("--path")?.unwrap_or_default(); | ||
89 | let highlight_path = matches.value_from_str("--highlight")?; | ||
90 | let complete_path = matches.value_from_str("--complete")?; | ||
91 | if highlight_path.is_some() && complete_path.is_some() { | ||
92 | panic!("either --highlight or --complete must be set, not both") | ||
93 | } | ||
94 | let op = if let Some(path) = highlight_path { | ||
95 | let path: String = path; | ||
96 | analysis_bench::Op::Highlight { path: path.into() } | ||
97 | } else if let Some(path_line_col) = complete_path { | ||
98 | let path_line_col: String = path_line_col; | ||
99 | let (path_line, column) = rsplit_at_char(path_line_col.as_str(), ':')?; | ||
100 | let (path, line) = rsplit_at_char(path_line, ':')?; | ||
101 | analysis_bench::Op::Complete { | ||
102 | path: path.into(), | ||
103 | line: line.parse()?, | ||
104 | column: column.parse()?, | ||
105 | } | ||
106 | } else { | ||
107 | panic!("either --highlight or --complete must be set") | ||
108 | }; | ||
109 | matches.finish().or_else(handle_extra_flags)?; | ||
110 | analysis_bench::run(verbose, path.as_ref(), op)?; | ||
115 | } | 111 | } |
116 | _ => help::print_global_help(), | 112 | _ => eprintln!("{}", help::GLOBAL_HELP), |
117 | } | 113 | } |
118 | Ok(()) | 114 | Ok(()) |
119 | } | 115 | } |
@@ -122,7 +118,7 @@ fn handle_extra_flags(e: pico_args::Error) -> Result<()> { | |||
122 | if let pico_args::Error::UnusedArgsLeft(flags) = e { | 118 | if let pico_args::Error::UnusedArgsLeft(flags) = e { |
123 | let mut invalid_flags = String::new(); | 119 | let mut invalid_flags = String::new(); |
124 | for flag in flags { | 120 | for flag in flags { |
125 | write!(&mut invalid_flags, "{}, ", flag).expect("Error on write"); | 121 | write!(&mut invalid_flags, "{}, ", flag)?; |
126 | } | 122 | } |
127 | let (invalid_flags, _) = invalid_flags.split_at(invalid_flags.len() - 2); | 123 | let (invalid_flags, _) = invalid_flags.split_at(invalid_flags.len() - 2); |
128 | Err(format!("Invalid flags: {}", invalid_flags).into()) | 124 | Err(format!("Invalid flags: {}", invalid_flags).into()) |
diff --git a/crates/ra_tools/src/help.rs b/crates/ra_tools/src/help.rs index 5bfe65734..6dde6c2d2 100644 --- a/crates/ra_tools/src/help.rs +++ b/crates/ra_tools/src/help.rs | |||
@@ -1,6 +1,4 @@ | |||
1 | pub fn print_global_help() { | 1 | pub const GLOBAL_HELP: &str = "tasks |
2 | println!( | ||
3 | "tasks | ||
4 | 2 | ||
5 | USAGE: | 3 | USAGE: |
6 | ra_tools <SUBCOMMAND> | 4 | ra_tools <SUBCOMMAND> |
@@ -15,13 +13,9 @@ SUBCOMMANDS: | |||
15 | gen-syntax | 13 | gen-syntax |
16 | gen-tests | 14 | gen-tests |
17 | install-ra | 15 | install-ra |
18 | lint" | 16 | lint"; |
19 | ) | ||
20 | } | ||
21 | 17 | ||
22 | pub fn print_install_ra_help() { | 18 | pub const INSTALL_RA_HELP: &str = "ra_tools-install-ra |
23 | println!( | ||
24 | "ra_tools-install-ra | ||
25 | 19 | ||
26 | USAGE: | 20 | USAGE: |
27 | ra_tools.exe install-ra [FLAGS] | 21 | ra_tools.exe install-ra [FLAGS] |
@@ -30,12 +24,10 @@ FLAGS: | |||
30 | --client-code | 24 | --client-code |
31 | -h, --help Prints help information | 25 | -h, --help Prints help information |
32 | --jemalloc | 26 | --jemalloc |
33 | --server" | 27 | --server"; |
34 | ) | ||
35 | } | ||
36 | 28 | ||
37 | pub fn print_no_param_subcommand_help(subcommand: &str) { | 29 | pub fn print_no_param_subcommand_help(subcommand: &str) { |
38 | println!( | 30 | eprintln!( |
39 | "ra_tools-{} | 31 | "ra_tools-{} |
40 | 32 | ||
41 | USAGE: | 33 | USAGE: |
@@ -47,10 +39,7 @@ FLAGS: | |||
47 | ); | 39 | ); |
48 | } | 40 | } |
49 | 41 | ||
50 | pub fn print_install_ra_conflict() { | 42 | pub const INSTALL_RA_CONFLICT: &str = |
51 | println!( | 43 | "error: The argument `--server` cannot be used with `--client-code` |
52 | "error: The argument `--server` cannot be used with `--client-code` | ||
53 | 44 | ||
54 | For more information try --help" | 45 | For more information try --help"; |
55 | ) | ||
56 | } | ||
diff --git a/crates/ra_tools/src/main.rs b/crates/ra_tools/src/main.rs index 5410edea9..f96f1875f 100644 --- a/crates/ra_tools/src/main.rs +++ b/crates/ra_tools/src/main.rs | |||
@@ -23,84 +23,78 @@ struct ServerOpt { | |||
23 | } | 23 | } |
24 | 24 | ||
25 | fn main() -> Result<()> { | 25 | fn main() -> Result<()> { |
26 | let subcommand = std::env::args_os().nth(1); | 26 | let subcommand = match std::env::args_os().nth(1) { |
27 | if subcommand.is_none() { | 27 | None => { |
28 | help::print_global_help(); | 28 | eprintln!("{}", help::GLOBAL_HELP); |
29 | return Ok(()); | 29 | return Ok(()); |
30 | } | 30 | } |
31 | let subcommand = subcommand.unwrap(); | 31 | Some(s) => s, |
32 | }; | ||
32 | let mut matches = Arguments::from_vec(std::env::args_os().skip(2).collect()); | 33 | let mut matches = Arguments::from_vec(std::env::args_os().skip(2).collect()); |
33 | let subcommand = &*subcommand.to_string_lossy(); | 34 | let subcommand = &*subcommand.to_string_lossy(); |
34 | match subcommand { | 35 | match subcommand { |
35 | "install-ra" | "install-code" => { | 36 | "install-ra" | "install-code" => { |
36 | if matches.contains(["-h", "--help"]) { | 37 | if matches.contains(["-h", "--help"]) { |
37 | help::print_install_ra_help(); | 38 | eprintln!("{}", help::INSTALL_RA_HELP); |
39 | return Ok(()); | ||
40 | } | ||
41 | let server = matches.contains("--server"); | ||
42 | let client_code = matches.contains("--client-code"); | ||
43 | if server && client_code { | ||
44 | eprintln!("{}", help::INSTALL_RA_CONFLICT); | ||
38 | return Ok(()); | 45 | return Ok(()); |
39 | } else { | ||
40 | let server = matches.contains("--server"); | ||
41 | let client_code = matches.contains("--client-code"); | ||
42 | if server && client_code { | ||
43 | help::print_install_ra_conflict(); | ||
44 | return Ok(()); | ||
45 | } | ||
46 | let jemalloc = matches.contains("--jemalloc"); | ||
47 | matches.finish().or_else(handle_extra_flags)?; | ||
48 | let opts = InstallOpt { | ||
49 | client: if server { None } else { Some(ClientOpt::VsCode) }, | ||
50 | server: if client_code { None } else { Some(ServerOpt { jemalloc: jemalloc }) }, | ||
51 | }; | ||
52 | install(opts)? | ||
53 | } | 46 | } |
47 | let jemalloc = matches.contains("--jemalloc"); | ||
48 | matches.finish().or_else(handle_extra_flags)?; | ||
49 | let opts = InstallOpt { | ||
50 | client: if server { None } else { Some(ClientOpt::VsCode) }, | ||
51 | server: if client_code { None } else { Some(ServerOpt { jemalloc: jemalloc }) }, | ||
52 | }; | ||
53 | install(opts)? | ||
54 | } | 54 | } |
55 | "gen-tests" => { | 55 | "gen-tests" => { |
56 | if matches.contains(["-h", "--help"]) { | 56 | if matches.contains(["-h", "--help"]) { |
57 | help::print_no_param_subcommand_help(&subcommand); | 57 | help::print_no_param_subcommand_help(&subcommand); |
58 | return Ok(()); | 58 | return Ok(()); |
59 | } else { | ||
60 | gen_tests(Overwrite)? | ||
61 | } | 59 | } |
60 | gen_tests(Overwrite)? | ||
62 | } | 61 | } |
63 | "gen-syntax" => { | 62 | "gen-syntax" => { |
64 | if matches.contains(["-h", "--help"]) { | 63 | if matches.contains(["-h", "--help"]) { |
65 | help::print_no_param_subcommand_help(&subcommand); | 64 | help::print_no_param_subcommand_help(&subcommand); |
66 | return Ok(()); | 65 | return Ok(()); |
67 | } else { | ||
68 | generate_boilerplate(Overwrite)? | ||
69 | } | 66 | } |
67 | generate_boilerplate(Overwrite)? | ||
70 | } | 68 | } |
71 | "format" => { | 69 | "format" => { |
72 | if matches.contains(["-h", "--help"]) { | 70 | if matches.contains(["-h", "--help"]) { |
73 | help::print_no_param_subcommand_help(&subcommand); | 71 | help::print_no_param_subcommand_help(&subcommand); |
74 | return Ok(()); | 72 | return Ok(()); |
75 | } else { | ||
76 | run_rustfmt(Overwrite)? | ||
77 | } | 73 | } |
74 | run_rustfmt(Overwrite)? | ||
78 | } | 75 | } |
79 | "format-hook" => { | 76 | "format-hook" => { |
80 | if matches.contains(["-h", "--help"]) { | 77 | if matches.contains(["-h", "--help"]) { |
81 | help::print_no_param_subcommand_help(&subcommand); | 78 | help::print_no_param_subcommand_help(&subcommand); |
82 | return Ok(()); | 79 | return Ok(()); |
83 | } else { | ||
84 | install_format_hook()? | ||
85 | } | 80 | } |
81 | install_format_hook()? | ||
86 | } | 82 | } |
87 | "lint" => { | 83 | "lint" => { |
88 | if matches.contains(["-h", "--help"]) { | 84 | if matches.contains(["-h", "--help"]) { |
89 | help::print_no_param_subcommand_help(&subcommand); | 85 | help::print_no_param_subcommand_help(&subcommand); |
90 | return Ok(()); | 86 | return Ok(()); |
91 | } else { | ||
92 | run_clippy()? | ||
93 | } | 87 | } |
88 | run_clippy()? | ||
94 | } | 89 | } |
95 | "fuzz-tests" => { | 90 | "fuzz-tests" => { |
96 | if matches.contains(["-h", "--help"]) { | 91 | if matches.contains(["-h", "--help"]) { |
97 | help::print_no_param_subcommand_help(&subcommand); | 92 | help::print_no_param_subcommand_help(&subcommand); |
98 | return Ok(()); | 93 | return Ok(()); |
99 | } else { | ||
100 | run_fuzzer()? | ||
101 | } | 94 | } |
95 | run_fuzzer()? | ||
102 | } | 96 | } |
103 | _ => help::print_global_help(), | 97 | _ => eprintln!("{}", help::GLOBAL_HELP), |
104 | } | 98 | } |
105 | Ok(()) | 99 | Ok(()) |
106 | } | 100 | } |
@@ -109,7 +103,7 @@ fn handle_extra_flags(e: pico_args::Error) -> Result<()> { | |||
109 | if let pico_args::Error::UnusedArgsLeft(flags) = e { | 103 | if let pico_args::Error::UnusedArgsLeft(flags) = e { |
110 | let mut invalid_flags = String::new(); | 104 | let mut invalid_flags = String::new(); |
111 | for flag in flags { | 105 | for flag in flags { |
112 | write!(&mut invalid_flags, "{}, ", flag).expect("Error on write"); | 106 | write!(&mut invalid_flags, "{}, ", flag)?; |
113 | } | 107 | } |
114 | let (invalid_flags, _) = invalid_flags.split_at(invalid_flags.len() - 2); | 108 | let (invalid_flags, _) = invalid_flags.split_at(invalid_flags.len() - 2); |
115 | Err(format!("Invalid flags: {}", invalid_flags).into()) | 109 | Err(format!("Invalid flags: {}", invalid_flags).into()) |