Skip to content

Commit 41a7e15

Browse files
committed
Auto merge of #6387 - dwijnand:rust-2018, r=dwijnand
Upgrade to Rust 2018 & fix edition idioms None
2 parents cae455e + 5aebc8a commit 41a7e15

File tree

206 files changed

+696
-694
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+696
-694
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ matrix:
3636
# increased every 6 weeks or so when the first PR to use a new feature.
3737
- env: TARGET=x86_64-unknown-linux-gnu
3838
ALT=i686-unknown-linux-gnu
39-
rust: 1.28.0
39+
rust: 1.31.0
4040
script:
4141
- rustup toolchain install nightly
4242
- cargo +nightly generate-lockfile -Z minimal-versions

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "cargo"
33
version = "0.33.0"
4+
edition = "2018"
45
authors = ["Yehuda Katz <wycats@gmail.com>",
56
"Carl Lerche <me@carllerche.com>",
67
"Alex Crichton <alex@alexcrichton.com>"]

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ install:
1111
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
1212
- rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly
1313
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
14-
- if defined MINIMAL_VERSIONS rustup toolchain install 1.28.0
14+
- if defined MINIMAL_VERSIONS rustup toolchain install 1.31.0
1515
- if defined OTHER_TARGET rustup target add %OTHER_TARGET%
1616
- rustc -V
1717
- cargo -V
@@ -25,5 +25,5 @@ test_script:
2525
# we don't have ci time to run the full `cargo test` with `minimal-versions` like
2626
# - if defined MINIMAL_VERSIONS cargo +nightly generate-lockfile -Z minimal-versions && cargo +stable test
2727
# so we just run `cargo check --tests` like
28-
- if defined MINIMAL_VERSIONS cargo +nightly generate-lockfile -Z minimal-versions && cargo +1.28.0 check --tests
28+
- if defined MINIMAL_VERSIONS cargo +nightly generate-lockfile -Z minimal-versions && cargo +1.31.0 check --tests
2929
- if NOT defined MINIMAL_VERSIONS cargo test

src/bin/cargo/cli.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
extern crate clap;
1+
use clap;
22

33
use clap::{AppSettings, Arg, ArgMatches};
44

55
use cargo::{self, CliResult, Config};
66

77
use super::commands;
88
use super::list_commands;
9-
use command_prelude::*;
9+
use crate::command_prelude::*;
1010

1111
pub fn main(config: &mut Config) -> CliResult {
1212
let args = match cli().get_matches_safe() {
@@ -132,7 +132,7 @@ fn expand_aliases(
132132
Ok(args)
133133
}
134134

135-
fn execute_subcommand(config: &mut Config, args: &ArgMatches) -> CliResult {
135+
fn execute_subcommand(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
136136
let (cmd, subcommand_args) = match args.subcommand() {
137137
(cmd, Some(args)) => (cmd, args),
138138
_ => {

src/bin/cargo/commands/bench.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops::{self, TestOptions};
44

@@ -70,7 +70,7 @@ Compilation can be customized with the `bench` profile in the manifest.
7070
)
7171
}
7272

73-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
73+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
7474
let ws = args.workspace(config)?;
7575
let mut compile_opts = args.compile_options(config, CompileMode::Bench)?;
7676
compile_opts.build_config.release = true;

src/bin/cargo/commands/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops;
44

@@ -46,7 +46,7 @@ the --release flag will use the `release` profile instead.
4646
)
4747
}
4848

49-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
49+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
5050
let ws = args.workspace(config)?;
5151
let mut compile_opts = args.compile_options(config, CompileMode::Build)?;
5252
compile_opts.export_dir = args.value_of_path("out-dir", config);

src/bin/cargo/commands/check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops;
44

@@ -53,7 +53,7 @@ The `--profile test` flag can be used to check unit tests with the
5353
)
5454
}
5555

56-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
56+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
5757
let ws = args.workspace(config)?;
5858
let test = match args.value_of("profile") {
5959
Some("test") => true,

src/bin/cargo/commands/clean.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops::{self, CleanOptions};
44

@@ -21,7 +21,7 @@ and its format, see the `cargo help pkgid` command.
2121
)
2222
}
2323

24-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
24+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
2525
let ws = args.workspace(config)?;
2626
let opts = CleanOptions {
2727
config,

src/bin/cargo/commands/doc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops::{self, DocOptions};
44

@@ -45,7 +45,7 @@ the `cargo help pkgid` command.
4545
)
4646
}
4747

48-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
48+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
4949
let ws = args.workspace(config)?;
5050
let mode = CompileMode::Doc {
5151
deps: !args.is_present("no-deps"),

src/bin/cargo/commands/fetch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops;
44
use cargo::ops::FetchOptions;
@@ -22,7 +22,7 @@ all updated.
2222
)
2323
}
2424

25-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
25+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
2626
let ws = args.workspace(config)?;
2727

2828
let opts = FetchOptions {

src/bin/cargo/commands/fix.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops::{self, CompileFilter, FilterRule};
44

@@ -104,7 +104,7 @@ https://github.com/rust-lang/cargo
104104
)
105105
}
106106

107-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
107+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
108108
let ws = args.workspace(config)?;
109109
let test = match args.value_of("profile") {
110110
Some("test") => true,

src/bin/cargo/commands/generate_lockfile.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops;
44

@@ -8,7 +8,7 @@ pub fn cli() -> App {
88
.arg_manifest_path()
99
}
1010

11-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
11+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
1212
let ws = args.workspace(config)?;
1313
ops::generate_lockfile(&ws)?;
1414
Ok(())

src/bin/cargo/commands/git_checkout.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::core::{GitReference, Source, SourceId};
44
use cargo::sources::GitSource;
@@ -21,7 +21,7 @@ pub fn cli() -> App {
2121
)
2222
}
2323

24-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
24+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
2525
let url = args.value_of("url").unwrap().to_url()?;
2626
let reference = args.value_of("reference").unwrap();
2727

src/bin/cargo/commands/init.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops;
44

@@ -10,7 +10,7 @@ pub fn cli() -> App {
1010
.arg_new_opts()
1111
}
1212

13-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
13+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
1414
let opts = args.new_options(config)?;
1515
ops::init(&opts, config)?;
1616
config

src/bin/cargo/commands/install.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::core::{GitReference, SourceId};
44
use cargo::ops;
@@ -74,7 +74,7 @@ continuous integration systems.",
7474
)
7575
}
7676

77-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
77+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
7878
let registry = args.registry(config)?;
7979

8080
config.reload_rooted_at_cargo_home()?;

src/bin/cargo/commands/locate_project.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::print_json;
44

@@ -13,7 +13,7 @@ pub struct ProjectLocation<'a> {
1313
root: &'a str,
1414
}
1515

16-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
16+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
1717
let root = args.root_manifest(config)?;
1818

1919
let root = root.to_str()

src/bin/cargo/commands/login.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use std::io::{self, BufRead};
44

@@ -18,7 +18,7 @@ pub fn cli() -> App {
1818
.arg(opt("registry", "Registry to use").value_name("REGISTRY"))
1919
}
2020

21-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
21+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
2222
let registry = args.registry(config)?;
2323

2424
let token = match args.value_of("token") {

src/bin/cargo/commands/metadata.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops::{self, OutputMetadataOptions};
44
use cargo::print_json;
@@ -24,7 +24,7 @@ pub fn cli() -> App {
2424
)
2525
}
2626

27-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
27+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
2828
let ws = args.workspace(config)?;
2929

3030
let version = match args.value_of("format-version") {

src/bin/cargo/commands/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
pub fn builtin() -> Vec<App> {
44
vec![
@@ -35,7 +35,7 @@ pub fn builtin() -> Vec<App> {
3535
]
3636
}
3737

38-
pub fn builtin_exec(cmd: &str) -> Option<fn(&mut Config, &ArgMatches) -> CliResult> {
38+
pub fn builtin_exec(cmd: &str) -> Option<fn(&mut Config, &ArgMatches<'_>) -> CliResult> {
3939
let f = match cmd {
4040
"bench" => bench::exec,
4141
"build" => build::exec,

src/bin/cargo/commands/new.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops;
44

@@ -10,7 +10,7 @@ pub fn cli() -> App {
1010
.arg_new_opts()
1111
}
1212

13-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
13+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
1414
let opts = args.new_options(config)?;
1515

1616
ops::new(&opts, config)?;

src/bin/cargo/commands/owner.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops::{self, OwnersOptions};
44

@@ -28,7 +28,7 @@ Explicitly named owners can also modify the set of owners, so take care!
2828
)
2929
}
3030

31-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
31+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
3232
let registry = args.registry(config)?;
3333
let opts = OwnersOptions {
3434
krate: args.value_of("crate").map(|s| s.to_string()),

src/bin/cargo/commands/package.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops::{self, PackageOpts};
44

@@ -29,7 +29,7 @@ pub fn cli() -> App {
2929
.arg_jobs()
3030
}
3131

32-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
32+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
3333
let ws = args.workspace(config)?;
3434
ops::package(
3535
&ws,

src/bin/cargo/commands/pkgid.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops;
44

@@ -32,7 +32,7 @@ Example Package IDs
3232
)
3333
}
3434

35-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
35+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
3636
let ws = args.workspace(config)?;
3737
let spec = args.value_of("spec").or_else(|| args.value_of("package"));
3838
let spec = ops::pkgid(&ws, spec)?;

src/bin/cargo/commands/publish.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::ops::{self, PublishOpts};
44

@@ -23,7 +23,7 @@ pub fn cli() -> App {
2323
.arg(opt("registry", "Registry to publish to").value_name("REGISTRY"))
2424
}
2525

26-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
26+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
2727
let registry = args.registry(config)?;
2828
let ws = args.workspace(config)?;
2929
let index = args.index(config)?;

src/bin/cargo/commands/read_manifest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::print_json;
44

@@ -14,7 +14,7 @@ Deprecated, use `cargo metadata --no-deps` instead.\
1414
.arg_manifest_path()
1515
}
1616

17-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
17+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
1818
let ws = args.workspace(config)?;
1919
print_json(&ws.current()?);
2020
Ok(())

src/bin/cargo/commands/run.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use command_prelude::*;
1+
use crate::command_prelude::*;
22

33
use cargo::core::Verbosity;
44
use cargo::ops::{self, CompileFilter};
@@ -36,7 +36,7 @@ run. If you're passing arguments to both Cargo and the binary, the ones after
3636
)
3737
}
3838

39-
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
39+
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
4040
let ws = args.workspace(config)?;
4141

4242
let mut compile_opts = args.compile_options(config, CompileMode::Build)?;

0 commit comments

Comments
 (0)