Skip to content

Commit eea00dc

Browse files
committed
---
yaml --- r: 106142 b: refs/heads/auto c: d50f5bd h: refs/heads/master v: v3
1 parent 32048f4 commit eea00dc

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
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: bc3a10b9f9890ba2ddde4bdb1b734ec7685d91a6
16+
refs/heads/auto: d50f5bd72287d5613c3b5f337bd338fcf9b60039
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/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)