Skip to content

Commit 7abd594

Browse files
bors[bot]pravic
andauthored
Merge #134
134: Tool help does not need build r=Emilgardis a=pravic `cargo size -- --help` tries to build first which makes little sense. fixes #133 Co-authored-by: pravic <[email protected]>
2 parents cdb87d8 + 63d5308 commit 7abd594

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/lib.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,17 +299,19 @@ pub fn run(tool: Tool, matches: ArgMatches) -> Result<i32> {
299299
bail!("Unable to find workspace members");
300300
}
301301

302-
let target_artifact = if tool.needs_build() {
303-
cargo_build(&matches, &metadata)?
304-
} else {
305-
None
306-
};
307-
308302
let mut tool_args = vec![];
309303
if let Some(args) = matches.values_of("args") {
310304
tool_args.extend(args);
311305
}
312306

307+
let tool_help = tool_args.first() == Some(&"--help");
308+
309+
let target_artifact = if tool.needs_build() && !tool_help {
310+
cargo_build(&matches, &metadata)?
311+
} else {
312+
None
313+
};
314+
313315
let mut lltool = Command::new(format!("rust-{}", tool.name()));
314316

315317
if tool == Tool::Objdump {

0 commit comments

Comments
 (0)