Merge pull request #4032 from catamorphism/getopts
[libstd] getopts, now with fewer copies
This commit is contained in:
commit
082a88e42c
10 changed files with 68 additions and 53 deletions
|
|
@ -458,7 +458,7 @@ fn host_triple() -> ~str {
|
|||
}
|
||||
|
||||
fn build_session_options(binary: ~str,
|
||||
matches: getopts::Matches,
|
||||
matches: &getopts::Matches,
|
||||
demitter: diagnostic::emitter) -> @session::options {
|
||||
let crate_type = if opt_present(matches, ~"lib") {
|
||||
session::lib_crate
|
||||
|
|
@ -807,7 +807,7 @@ mod test {
|
|||
#[test]
|
||||
fn test_switch_implies_cfg_test() {
|
||||
let matches =
|
||||
match getopts(~[~"--test"], optgroups()) {
|
||||
&match getopts(~[~"--test"], optgroups()) {
|
||||
Ok(m) => m,
|
||||
Err(f) => fail ~"test_switch_implies_cfg_test: " +
|
||||
getopts::fail_str(f)
|
||||
|
|
@ -824,7 +824,7 @@ mod test {
|
|||
#[test]
|
||||
fn test_switch_implies_cfg_test_unless_cfg_test() {
|
||||
let matches =
|
||||
match getopts(~[~"--test", ~"--cfg=test"], optgroups()) {
|
||||
&match getopts(~[~"--test", ~"--cfg=test"], optgroups()) {
|
||||
Ok(m) => m,
|
||||
Err(f) => {
|
||||
fail ~"test_switch_implies_cfg_test_unless_cfg_test: " +
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ struct RH {
|
|||
}
|
||||
|
||||
fn setup_env(test_name: &str, source_string: &str) -> Env {
|
||||
let matches = getopts(~[~"-Z", ~"verbose"], optgroups()).get();
|
||||
let matches = &getopts(~[~"-Z", ~"verbose"], optgroups()).get();
|
||||
let sessopts = build_session_options(~"rustc", matches, diagnostic::emit);
|
||||
let sess = build_session(sessopts, diagnostic::emit);
|
||||
let cfg = build_configuration(sess, ~"whatever", str_input(~""));
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ fn run_compiler(args: &~[~str], demitter: diagnostic::emitter) {
|
|||
if args.is_empty() { usage(binary); return; }
|
||||
|
||||
let matches =
|
||||
match getopts::groups::getopts(args, optgroups()) {
|
||||
&match getopts::groups::getopts(args, optgroups()) {
|
||||
Ok(m) => m,
|
||||
Err(f) => {
|
||||
early_error(demitter, getopts::fail_str(f))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue