Skip to content

Commit 8ec179d

Browse files
committed
---
yaml --- r: 105004 b: refs/heads/snap-stage3 c: d50f5bd h: refs/heads/master v: v3
1 parent 904ce96 commit 8ec179d

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 62f1d68439dcfd509eaca29887afa97f22938373
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: bc3a10b9f9890ba2ddde4bdb1b734ec7685d91a6
4+
refs/heads/snap-stage3: d50f5bd72287d5613c3b5f337bd338fcf9b60039
55
refs/heads/try: db814977d07bd798feb24f6b74c00800ef458a13
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libgetopts/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
html_root_url = "http://static.rust-lang.org/doc/master")];
8686
#[feature(globs, phase)];
8787
#[deny(missing_doc)];
88-
#[allow(deprecated_owned_vector)]; // NOTE: remove after stage0
88+
#[deny(deprecated_owned_vector)];
8989

9090
#[cfg(test)] #[phase(syntax, link)] extern crate log;
9191

@@ -516,7 +516,7 @@ impl Fail_ {
516516
/// `opt_str`, etc. to interrogate results. Returns `Err(Fail_)` on failure.
517517
/// Use `to_err_msg` to get an error message.
518518
pub fn getopts(args: &[~str], optgrps: &[OptGroup]) -> Result {
519-
let opts = optgrps.map(|x| x.long_to_short());
519+
let opts: Vec<Opt> = optgrps.iter().map(|x| x.long_to_short()).collect();
520520
let n_opts = opts.len();
521521

522522
fn f(_x: uint) -> Vec<Optval> { return Vec::new(); }
@@ -562,12 +562,12 @@ pub fn getopts(args: &[~str], optgrps: &[OptGroup]) -> Result {
562562
interpreted correctly
563563
*/
564564
565-
match find_opt(opts, opt.clone()) {
565+
match find_opt(opts.as_slice(), opt.clone()) {
566566
Some(id) => last_valid_opt_id = Some(id),
567567
None => {
568568
let arg_follows =
569569
last_valid_opt_id.is_some() &&
570-
match opts[last_valid_opt_id.unwrap()]
570+
match opts.get(last_valid_opt_id.unwrap())
571571
.hasarg {
572572
573573
Yes | Maybe => true,
@@ -588,11 +588,11 @@ pub fn getopts(args: &[~str], optgrps: &[OptGroup]) -> Result {
588588
let mut name_pos = 0;
589589
for nm in names.iter() {
590590
name_pos += 1;
591-
let optid = match find_opt(opts, (*nm).clone()) {
591+
let optid = match find_opt(opts.as_slice(), (*nm).clone()) {
592592
Some(id) => id,
593593
None => return Err(UnrecognizedOption(nm.to_str()))
594594
};
595-
match opts[optid].hasarg {
595+
match opts.get(optid).hasarg {
596596
No => {
597597
if !i_arg.is_none() {
598598
return Err(UnexpectedArgument(nm.to_str()));
@@ -630,21 +630,21 @@ pub fn getopts(args: &[~str], optgrps: &[OptGroup]) -> Result {
630630
i = 0u;
631631
while i < n_opts {
632632
let n = vals.get(i).len();
633-
let occ = opts[i].occur;
633+
let occ = opts.get(i).occur;
634634
if occ == Req {
635635
if n == 0 {
636-
return Err(OptionMissing(opts[i].name.to_str()));
636+
return Err(OptionMissing(opts.get(i).name.to_str()));
637637
}
638638
}
639639
if occ != Multi {
640640
if n > 1 {
641-
return Err(OptionDuplicated(opts[i].name.to_str()));
641+
return Err(OptionDuplicated(opts.get(i).name.to_str()));
642642
}
643643
}
644644
i += 1;
645645
}
646646
Ok(Matches {
647-
opts: Vec::from_slice(opts),
647+
opts: opts,
648648
vals: vals,
649649
free: free
650650
})
@@ -772,7 +772,7 @@ fn format_option(opt: &OptGroup) -> ~str {
772772
/// Derive a short one-line usage summary from a set of long options.
773773
pub fn short_usage(program_name: &str, opts: &[OptGroup]) -> ~str {
774774
let mut line = ~"Usage: " + program_name + " ";
775-
line.push_str(opts.iter().map(format_option).to_owned_vec().connect(" "));
775+
line.push_str(opts.iter().map(format_option).collect::<Vec<~str>>().connect(" "));
776776
777777
line
778778
}

0 commit comments

Comments
 (0)