mirror of
https://github.com/rust-lang/cargo
synced 2024-08-28 11:50:23 +00:00
Auto merge of #6387 - dwijnand:rust-2018, r=dwijnand
Upgrade to Rust 2018 & fix edition idioms None
This commit is contained in:
commit
41a7e150fc
|
@ -36,7 +36,7 @@ matrix:
|
|||
# increased every 6 weeks or so when the first PR to use a new feature.
|
||||
- env: TARGET=x86_64-unknown-linux-gnu
|
||||
ALT=i686-unknown-linux-gnu
|
||||
rust: 1.28.0
|
||||
rust: 1.31.0
|
||||
script:
|
||||
- rustup toolchain install nightly
|
||||
- cargo +nightly generate-lockfile -Z minimal-versions
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
[package]
|
||||
name = "cargo"
|
||||
version = "0.33.0"
|
||||
edition = "2018"
|
||||
authors = ["Yehuda Katz <wycats@gmail.com>",
|
||||
"Carl Lerche <me@carllerche.com>",
|
||||
"Alex Crichton <alex@alexcrichton.com>"]
|
||||
|
|
|
@ -11,7 +11,7 @@ install:
|
|||
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
||||
- rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly
|
||||
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
|
||||
- if defined MINIMAL_VERSIONS rustup toolchain install 1.28.0
|
||||
- if defined MINIMAL_VERSIONS rustup toolchain install 1.31.0
|
||||
- if defined OTHER_TARGET rustup target add %OTHER_TARGET%
|
||||
- rustc -V
|
||||
- cargo -V
|
||||
|
@ -25,5 +25,5 @@ test_script:
|
|||
# we don't have ci time to run the full `cargo test` with `minimal-versions` like
|
||||
# - if defined MINIMAL_VERSIONS cargo +nightly generate-lockfile -Z minimal-versions && cargo +stable test
|
||||
# so we just run `cargo check --tests` like
|
||||
- if defined MINIMAL_VERSIONS cargo +nightly generate-lockfile -Z minimal-versions && cargo +1.28.0 check --tests
|
||||
- if defined MINIMAL_VERSIONS cargo +nightly generate-lockfile -Z minimal-versions && cargo +1.31.0 check --tests
|
||||
- if NOT defined MINIMAL_VERSIONS cargo test
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extern crate clap;
|
||||
use clap;
|
||||
|
||||
use clap::{AppSettings, Arg, ArgMatches};
|
||||
|
||||
|
@ -6,7 +6,7 @@ use cargo::{self, CliResult, Config};
|
|||
|
||||
use super::commands;
|
||||
use super::list_commands;
|
||||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
pub fn main(config: &mut Config) -> CliResult {
|
||||
let args = match cli().get_matches_safe() {
|
||||
|
@ -132,7 +132,7 @@ fn expand_aliases(
|
|||
Ok(args)
|
||||
}
|
||||
|
||||
fn execute_subcommand(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
fn execute_subcommand(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let (cmd, subcommand_args) = match args.subcommand() {
|
||||
(cmd, Some(args)) => (cmd, args),
|
||||
_ => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops::{self, TestOptions};
|
||||
|
||||
|
@ -70,7 +70,7 @@ Compilation can be customized with the `bench` profile in the manifest.
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
let mut compile_opts = args.compile_options(config, CompileMode::Bench)?;
|
||||
compile_opts.build_config.release = true;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops;
|
||||
|
||||
|
@ -46,7 +46,7 @@ the --release flag will use the `release` profile instead.
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
let mut compile_opts = args.compile_options(config, CompileMode::Build)?;
|
||||
compile_opts.export_dir = args.value_of_path("out-dir", config);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops;
|
||||
|
||||
|
@ -53,7 +53,7 @@ The `--profile test` flag can be used to check unit tests with the
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
let test = match args.value_of("profile") {
|
||||
Some("test") => true,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops::{self, CleanOptions};
|
||||
|
||||
|
@ -21,7 +21,7 @@ and its format, see the `cargo help pkgid` command.
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
let opts = CleanOptions {
|
||||
config,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops::{self, DocOptions};
|
||||
|
||||
|
@ -45,7 +45,7 @@ the `cargo help pkgid` command.
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
let mode = CompileMode::Doc {
|
||||
deps: !args.is_present("no-deps"),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops;
|
||||
use cargo::ops::FetchOptions;
|
||||
|
@ -22,7 +22,7 @@ all updated.
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
|
||||
let opts = FetchOptions {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops::{self, CompileFilter, FilterRule};
|
||||
|
||||
|
@ -104,7 +104,7 @@ https://github.com/rust-lang/cargo
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
let test = match args.value_of("profile") {
|
||||
Some("test") => true,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops;
|
||||
|
||||
|
@ -8,7 +8,7 @@ pub fn cli() -> App {
|
|||
.arg_manifest_path()
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
ops::generate_lockfile(&ws)?;
|
||||
Ok(())
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::core::{GitReference, Source, SourceId};
|
||||
use cargo::sources::GitSource;
|
||||
|
@ -21,7 +21,7 @@ pub fn cli() -> App {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let url = args.value_of("url").unwrap().to_url()?;
|
||||
let reference = args.value_of("reference").unwrap();
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops;
|
||||
|
||||
|
@ -10,7 +10,7 @@ pub fn cli() -> App {
|
|||
.arg_new_opts()
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let opts = args.new_options(config)?;
|
||||
ops::init(&opts, config)?;
|
||||
config
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::core::{GitReference, SourceId};
|
||||
use cargo::ops;
|
||||
|
@ -74,7 +74,7 @@ continuous integration systems.",
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let registry = args.registry(config)?;
|
||||
|
||||
config.reload_rooted_at_cargo_home()?;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::print_json;
|
||||
|
||||
|
@ -13,7 +13,7 @@ pub struct ProjectLocation<'a> {
|
|||
root: &'a str,
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let root = args.root_manifest(config)?;
|
||||
|
||||
let root = root.to_str()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use std::io::{self, BufRead};
|
||||
|
||||
|
@ -18,7 +18,7 @@ pub fn cli() -> App {
|
|||
.arg(opt("registry", "Registry to use").value_name("REGISTRY"))
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let registry = args.registry(config)?;
|
||||
|
||||
let token = match args.value_of("token") {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops::{self, OutputMetadataOptions};
|
||||
use cargo::print_json;
|
||||
|
@ -24,7 +24,7 @@ pub fn cli() -> App {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
|
||||
let version = match args.value_of("format-version") {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
pub fn builtin() -> Vec<App> {
|
||||
vec![
|
||||
|
@ -35,7 +35,7 @@ pub fn builtin() -> Vec<App> {
|
|||
]
|
||||
}
|
||||
|
||||
pub fn builtin_exec(cmd: &str) -> Option<fn(&mut Config, &ArgMatches) -> CliResult> {
|
||||
pub fn builtin_exec(cmd: &str) -> Option<fn(&mut Config, &ArgMatches<'_>) -> CliResult> {
|
||||
let f = match cmd {
|
||||
"bench" => bench::exec,
|
||||
"build" => build::exec,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops;
|
||||
|
||||
|
@ -10,7 +10,7 @@ pub fn cli() -> App {
|
|||
.arg_new_opts()
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let opts = args.new_options(config)?;
|
||||
|
||||
ops::new(&opts, config)?;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops::{self, OwnersOptions};
|
||||
|
||||
|
@ -28,7 +28,7 @@ Explicitly named owners can also modify the set of owners, so take care!
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let registry = args.registry(config)?;
|
||||
let opts = OwnersOptions {
|
||||
krate: args.value_of("crate").map(|s| s.to_string()),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops::{self, PackageOpts};
|
||||
|
||||
|
@ -29,7 +29,7 @@ pub fn cli() -> App {
|
|||
.arg_jobs()
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
ops::package(
|
||||
&ws,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops;
|
||||
|
||||
|
@ -32,7 +32,7 @@ Example Package IDs
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
let spec = args.value_of("spec").or_else(|| args.value_of("package"));
|
||||
let spec = ops::pkgid(&ws, spec)?;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops::{self, PublishOpts};
|
||||
|
||||
|
@ -23,7 +23,7 @@ pub fn cli() -> App {
|
|||
.arg(opt("registry", "Registry to publish to").value_name("REGISTRY"))
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let registry = args.registry(config)?;
|
||||
let ws = args.workspace(config)?;
|
||||
let index = args.index(config)?;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::print_json;
|
||||
|
||||
|
@ -14,7 +14,7 @@ Deprecated, use `cargo metadata --no-deps` instead.\
|
|||
.arg_manifest_path()
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
print_json(&ws.current()?);
|
||||
Ok(())
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::core::Verbosity;
|
||||
use cargo::ops::{self, CompileFilter};
|
||||
|
@ -36,7 +36,7 @@ run. If you're passing arguments to both Cargo and the binary, the ones after
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
|
||||
let mut compile_opts = args.compile_options(config, CompileMode::Build)?;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops;
|
||||
|
||||
|
@ -46,7 +46,7 @@ processes spawned by Cargo, use the $RUSTFLAGS environment variable or the
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
let mode = match args.value_of("profile") {
|
||||
Some("dev") | None => CompileMode::Build,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops::{self, DocOptions};
|
||||
|
||||
|
@ -48,7 +48,7 @@ the `cargo help pkgid` command.
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
let mut compile_opts =
|
||||
args.compile_options_for_single_package(config, CompileMode::Doc { deps: false })?;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use std::cmp::min;
|
||||
|
||||
|
@ -18,7 +18,7 @@ pub fn cli() -> App {
|
|||
.arg(opt("registry", "Registry to use").value_name("REGISTRY"))
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let registry = args.registry(config)?;
|
||||
let index = args.index(config)?;
|
||||
let limit = args.value_of_u32("limit")?;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops::{self, CompileFilter};
|
||||
|
||||
|
@ -89,7 +89,7 @@ To get the list of all options available for the test binaries use this:
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
|
||||
let mut compile_opts = args.compile_options(config, CompileMode::Test)?;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops;
|
||||
|
||||
|
@ -19,7 +19,7 @@ only uninstall particular binaries.
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let root = args.value_of("root");
|
||||
let specs = args
|
||||
.values_of("spec")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops::{self, UpdateOptions};
|
||||
|
||||
|
@ -37,7 +37,7 @@ For more information about package id specifications, see `cargo help pkgid`.
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let ws = args.workspace(config)?;
|
||||
|
||||
let update_opts = UpdateOptions {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::process;
|
||||
|
@ -11,7 +11,7 @@ pub fn cli() -> App {
|
|||
.arg_manifest_path()
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
fn fail(reason: &str, value: &str) -> ! {
|
||||
let mut h = HashMap::new();
|
||||
h.insert(reason.to_string(), value.to_string());
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cli;
|
||||
use crate::cli;
|
||||
|
||||
pub fn cli() -> App {
|
||||
subcommand("version").about("Show version information")
|
||||
}
|
||||
|
||||
pub fn exec(_config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(_config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let verbose = args.occurrences_of("verbose") > 0;
|
||||
let version = cli::get_version_string(verbose);
|
||||
print!("{}", version);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::ops;
|
||||
|
||||
|
@ -27,7 +27,7 @@ crates to be locked to any yanked version.
|
|||
)
|
||||
}
|
||||
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
|
||||
let registry = args.registry(config)?;
|
||||
|
||||
ops::yank(
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::too_many_arguments))] // large project
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::redundant_closure))] // there's a false positive
|
||||
|
||||
extern crate cargo;
|
||||
extern crate clap;
|
||||
use cargo;
|
||||
|
||||
#[cfg(feature = "pretty-env-logger")]
|
||||
extern crate pretty_env_logger;
|
||||
#[cfg(not(feature = "pretty-env-logger"))]
|
||||
extern crate env_logger;
|
||||
#[macro_use]
|
||||
extern crate failure;
|
||||
extern crate git2_curl;
|
||||
extern crate log;
|
||||
use git2_curl;
|
||||
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde_json;
|
||||
extern crate toml;
|
||||
|
||||
|
||||
|
||||
use std::collections::BTreeSet;
|
||||
use std::env;
|
||||
|
@ -28,7 +28,7 @@ use cargo::util::{CliError, ProcessError};
|
|||
mod cli;
|
||||
mod commands;
|
||||
|
||||
use command_prelude::*;
|
||||
use crate::command_prelude::*;
|
||||
|
||||
fn main() {
|
||||
#[cfg(feature = "pretty-env-logger")]
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::path::Path;
|
|||
|
||||
use serde::ser;
|
||||
|
||||
use util::{CargoResult, CargoResultExt, Config, RustfixDiagnosticServer};
|
||||
use crate::util::{CargoResult, CargoResultExt, Config, RustfixDiagnosticServer};
|
||||
|
||||
/// Configuration information for a rustc build.
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -3,11 +3,11 @@ use std::env;
|
|||
use std::path::{Path, PathBuf};
|
||||
use std::str;
|
||||
|
||||
use core::profiles::Profiles;
|
||||
use core::{Dependency, Workspace};
|
||||
use core::{PackageId, PackageSet, Resolve};
|
||||
use util::errors::CargoResult;
|
||||
use util::{profile, Cfg, CfgExpr, Config, Rustc};
|
||||
use crate::core::profiles::Profiles;
|
||||
use crate::core::{Dependency, Workspace};
|
||||
use crate::core::{PackageId, PackageSet, Resolve};
|
||||
use crate::util::errors::CargoResult;
|
||||
use crate::util::{profile, Cfg, CfgExpr, Config, Rustc};
|
||||
|
||||
use super::{BuildConfig, BuildOutput, Kind, Unit};
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ use std::str::{self, FromStr};
|
|||
|
||||
use super::env_args;
|
||||
use super::Kind;
|
||||
use core::TargetKind;
|
||||
use util::{CargoResult, CargoResultExt, Cfg, Config, ProcessBuilder, Rustc};
|
||||
use crate::core::TargetKind;
|
||||
use crate::util::{CargoResult, CargoResultExt, Cfg, Config, ProcessBuilder, Rustc};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct TargetInfo {
|
||||
|
|
|
@ -10,11 +10,11 @@ use std::collections::BTreeMap;
|
|||
|
||||
use super::context::OutputFile;
|
||||
use super::{CompileMode, Context, Kind, Unit};
|
||||
use core::TargetKind;
|
||||
use crate::core::TargetKind;
|
||||
use semver;
|
||||
use serde_json;
|
||||
use std::path::PathBuf;
|
||||
use util::{internal, CargoResult, ProcessBuilder};
|
||||
use crate::util::{internal, CargoResult, ProcessBuilder};
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
struct Invocation {
|
||||
|
|
|
@ -6,8 +6,8 @@ use std::path::PathBuf;
|
|||
use semver::Version;
|
||||
|
||||
use super::BuildContext;
|
||||
use core::{Edition, Package, PackageId, Target, TargetKind};
|
||||
use util::{self, join_paths, process, CargoResult, CfgExpr, Config, ProcessBuilder};
|
||||
use crate::core::{Edition, Package, PackageId, Target, TargetKind};
|
||||
use crate::util::{self, join_paths, process, CargoResult, CfgExpr, Config, ProcessBuilder};
|
||||
|
||||
pub struct Doctest {
|
||||
/// The package being doctested.
|
||||
|
@ -205,7 +205,7 @@ impl<'cfg> Compilation<'cfg> {
|
|||
let metadata = pkg.manifest().metadata();
|
||||
|
||||
let cargo_exe = self.config.cargo_exe()?;
|
||||
cmd.env(::CARGO_ENV, cargo_exe);
|
||||
cmd.env(crate::CARGO_ENV, cargo_exe);
|
||||
|
||||
// When adding new environment variables depending on
|
||||
// crate properties which might require rebuild upon change
|
||||
|
|
|
@ -8,8 +8,8 @@ use std::sync::Arc;
|
|||
use lazycell::LazyCell;
|
||||
|
||||
use super::{BuildContext, Context, FileFlavor, Kind, Layout, Unit};
|
||||
use core::{TargetKind, Workspace};
|
||||
use util::{self, CargoResult};
|
||||
use crate::core::{TargetKind, Workspace};
|
||||
use crate::util::{self, CargoResult};
|
||||
|
||||
#[derive(Clone, Hash, Eq, PartialEq, Ord, PartialOrd)]
|
||||
pub struct Metadata(u64);
|
||||
|
|
|
@ -7,11 +7,11 @@ use std::sync::Arc;
|
|||
|
||||
use jobserver::Client;
|
||||
|
||||
use core::compiler::compilation;
|
||||
use core::profiles::Profile;
|
||||
use core::{Package, PackageId, Resolve, Target};
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::{internal, profile, short_hash, Config};
|
||||
use crate::core::compiler::compilation;
|
||||
use crate::core::profiles::Profile;
|
||||
use crate::core::{Package, PackageId, Resolve, Target};
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::{internal, profile, short_hash, Config};
|
||||
|
||||
use super::build_plan::BuildPlan;
|
||||
use super::custom_build::{self, BuildDeps, BuildScripts, BuildState};
|
||||
|
@ -514,7 +514,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
|
|||
Second unit: {:?}",
|
||||
describe_collision(unit, other_unit, path),
|
||||
suggestion,
|
||||
::version(), self.bcx.host_triple(), self.bcx.target_triple(),
|
||||
crate::version(), self.bcx.host_triple(), self.bcx.target_triple(),
|
||||
unit, other_unit))
|
||||
}
|
||||
};
|
||||
|
|
|
@ -19,11 +19,11 @@ use std::cell::RefCell;
|
|||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use super::{BuildContext, CompileMode, Kind, Unit};
|
||||
use core::dependency::Kind as DepKind;
|
||||
use core::package::Downloads;
|
||||
use core::profiles::UnitFor;
|
||||
use core::{Package, PackageId, Target};
|
||||
use CargoResult;
|
||||
use crate::core::dependency::Kind as DepKind;
|
||||
use crate::core::package::Downloads;
|
||||
use crate::core::profiles::UnitFor;
|
||||
use crate::core::{Package, PackageId, Target};
|
||||
use crate::CargoResult;
|
||||
|
||||
struct State<'a: 'tmp, 'cfg: 'a, 'tmp> {
|
||||
bcx: &'tmp BuildContext<'a, 'cfg>,
|
||||
|
|
|
@ -5,11 +5,11 @@ use std::path::{Path, PathBuf};
|
|||
use std::str;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use core::PackageId;
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::machine_message;
|
||||
use util::{self, internal, paths, profile};
|
||||
use util::{Cfg, Freshness};
|
||||
use crate::core::PackageId;
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::machine_message;
|
||||
use crate::util::{self, internal, paths, profile};
|
||||
use crate::util::{Cfg, Freshness};
|
||||
|
||||
use super::job::Work;
|
||||
use super::{fingerprint, Context, Kind, TargetConfig, Unit};
|
||||
|
|
|
@ -9,11 +9,11 @@ use serde::de::{self, Deserialize};
|
|||
use serde::ser;
|
||||
use serde_json;
|
||||
|
||||
use core::{Edition, Package};
|
||||
use util;
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::paths;
|
||||
use util::{internal, profile, Dirty, Fresh, Freshness};
|
||||
use crate::core::{Edition, Package};
|
||||
use crate::util;
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::paths;
|
||||
use crate::util::{internal, profile, Dirty, Fresh, Freshness};
|
||||
|
||||
use super::custom_build::BuildDeps;
|
||||
use super::job::Work;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::fmt;
|
||||
|
||||
use super::job_queue::JobState;
|
||||
use util::{CargoResult, Dirty, Fresh, Freshness};
|
||||
use crate::util::{CargoResult, Dirty, Fresh, Freshness};
|
||||
|
||||
pub struct Job {
|
||||
dirty: Work,
|
||||
|
|
|
@ -11,14 +11,14 @@ use crossbeam_utils;
|
|||
use crossbeam_utils::thread::Scope;
|
||||
use jobserver::{Acquired, HelperThread};
|
||||
|
||||
use core::profiles::Profile;
|
||||
use core::{PackageId, Target, TargetKind};
|
||||
use handle_error;
|
||||
use util;
|
||||
use util::diagnostic_server::{self, DiagnosticPrinter};
|
||||
use util::{internal, profile, CargoResult, CargoResultExt, ProcessBuilder};
|
||||
use util::{Config, DependencyQueue, Dirty, Fresh, Freshness};
|
||||
use util::{Progress, ProgressStyle};
|
||||
use crate::core::profiles::Profile;
|
||||
use crate::core::{PackageId, Target, TargetKind};
|
||||
use crate::handle_error;
|
||||
use crate::util;
|
||||
use crate::util::diagnostic_server::{self, DiagnosticPrinter};
|
||||
use crate::util::{internal, profile, CargoResult, CargoResultExt, ProcessBuilder};
|
||||
use crate::util::{Config, DependencyQueue, Dirty, Fresh, Freshness};
|
||||
use crate::util::{Progress, ProgressStyle};
|
||||
|
||||
use super::context::OutputFile;
|
||||
use super::job::Job;
|
||||
|
|
|
@ -53,8 +53,8 @@ use std::fs;
|
|||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use core::Workspace;
|
||||
use util::{CargoResult, Config, FileLock, Filesystem};
|
||||
use crate::core::Workspace;
|
||||
use crate::util::{CargoResult, Config, FileLock, Filesystem};
|
||||
|
||||
/// Contains the paths of all target output locations.
|
||||
///
|
||||
|
|
|
@ -9,13 +9,13 @@ use failure::Error;
|
|||
use same_file::is_same_file;
|
||||
use serde_json;
|
||||
|
||||
use core::manifest::TargetSourcePath;
|
||||
use core::profiles::{Lto, Profile};
|
||||
use core::{PackageId, Target};
|
||||
use util::errors::{CargoResult, CargoResultExt, Internal, ProcessError};
|
||||
use util::paths;
|
||||
use util::{self, machine_message, process, Freshness, ProcessBuilder};
|
||||
use util::{internal, join_paths, profile};
|
||||
use crate::core::manifest::TargetSourcePath;
|
||||
use crate::core::profiles::{Lto, Profile};
|
||||
use crate::core::{PackageId, Target};
|
||||
use crate::util::errors::{CargoResult, CargoResultExt, Internal, ProcessError};
|
||||
use crate::util::paths;
|
||||
use crate::util::{self, machine_message, process, Freshness, ProcessBuilder};
|
||||
use crate::util::{internal, join_paths, profile};
|
||||
|
||||
use self::build_plan::BuildPlan;
|
||||
use self::job::{Job, Work};
|
||||
|
|
|
@ -4,8 +4,8 @@ use std::io::{BufWriter, Write};
|
|||
use std::path::{Path, PathBuf};
|
||||
|
||||
use super::{fingerprint, Context, Unit};
|
||||
use util::paths;
|
||||
use util::{internal, CargoResult};
|
||||
use crate::util::paths;
|
||||
use crate::util::{internal, CargoResult};
|
||||
|
||||
fn render_filename<P: AsRef<Path>>(path: P, basedir: Option<&str>) -> CargoResult<String> {
|
||||
let path = path.as_ref();
|
||||
|
|
|
@ -6,10 +6,10 @@ use semver::ReqParseError;
|
|||
use semver::VersionReq;
|
||||
use serde::ser;
|
||||
|
||||
use core::interning::InternedString;
|
||||
use core::{PackageId, SourceId, Summary};
|
||||
use util::errors::{CargoError, CargoResult, CargoResultExt};
|
||||
use util::{Cfg, CfgExpr, Config};
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::{PackageId, SourceId, Summary};
|
||||
use crate::util::errors::{CargoError, CargoResult, CargoResultExt};
|
||||
use crate::util::{Cfg, CfgExpr, Config};
|
||||
|
||||
/// Information about a dependency requested by a Cargo manifest.
|
||||
/// Cheap to copy.
|
||||
|
|
|
@ -52,7 +52,7 @@ use std::str::FromStr;
|
|||
|
||||
use failure::Error;
|
||||
|
||||
use util::errors::CargoResult;
|
||||
use crate::util::errors::CargoResult;
|
||||
|
||||
/// The edition of the compiler (RFC 2052)
|
||||
#[derive(Clone, Copy, Debug, Hash, PartialOrd, Ord, Eq, PartialEq, Serialize, Deserialize)]
|
||||
|
@ -370,7 +370,7 @@ fn channel() -> String {
|
|||
return "dev".to_string();
|
||||
}
|
||||
}
|
||||
::version()
|
||||
crate::version()
|
||||
.cfg_info
|
||||
.map(|c| c.release_channel)
|
||||
.unwrap_or_else(|| String::from("dev"))
|
||||
|
|
|
@ -9,13 +9,13 @@ use serde::ser;
|
|||
use toml;
|
||||
use url::Url;
|
||||
|
||||
use core::interning::InternedString;
|
||||
use core::profiles::Profiles;
|
||||
use core::{Dependency, PackageId, PackageIdSpec, SourceId, Summary};
|
||||
use core::{Edition, Feature, Features, WorkspaceConfig};
|
||||
use util::errors::*;
|
||||
use util::toml::TomlManifest;
|
||||
use util::{short_hash, Config, Filesystem};
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::profiles::Profiles;
|
||||
use crate::core::{Dependency, PackageId, PackageIdSpec, SourceId, Summary};
|
||||
use crate::core::{Edition, Feature, Features, WorkspaceConfig};
|
||||
use crate::util::errors::*;
|
||||
use crate::util::toml::TomlManifest;
|
||||
use crate::util::{short_hash, Config, Filesystem};
|
||||
|
||||
pub enum EitherManifest {
|
||||
Real(Manifest),
|
||||
|
|
|
@ -18,14 +18,14 @@ use semver::Version;
|
|||
use serde::ser;
|
||||
use toml;
|
||||
|
||||
use core::interning::InternedString;
|
||||
use core::source::MaybePackage;
|
||||
use core::{Dependency, Manifest, PackageId, SourceId, Target};
|
||||
use core::{FeatureMap, SourceMap, Summary};
|
||||
use ops;
|
||||
use util::errors::{CargoResult, CargoResultExt, HttpNot200};
|
||||
use util::network::Retry;
|
||||
use util::{self, internal, lev_distance, Config, Progress, ProgressStyle};
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::source::MaybePackage;
|
||||
use crate::core::{Dependency, Manifest, PackageId, SourceId, Target};
|
||||
use crate::core::{FeatureMap, SourceMap, Summary};
|
||||
use crate::ops;
|
||||
use crate::util::errors::{CargoResult, CargoResultExt, HttpNot200};
|
||||
use crate::util::network::Retry;
|
||||
use crate::util::{self, internal, lev_distance, Config, Progress, ProgressStyle};
|
||||
|
||||
/// Information about a package that is available somewhere in the file system.
|
||||
///
|
||||
|
@ -598,7 +598,7 @@ impl<'a, 'cfg> Downloads<'a, 'cfg> {
|
|||
let timed_out = &dl.timed_out;
|
||||
let url = &dl.url;
|
||||
dl.retry
|
||||
.try(|| {
|
||||
.r#try(|| {
|
||||
if let Err(e) = result {
|
||||
// If this error is "aborted by callback" then that's
|
||||
// probably because our progress callback aborted due to
|
||||
|
|
|
@ -10,9 +10,9 @@ use semver;
|
|||
use serde::de;
|
||||
use serde::ser;
|
||||
|
||||
use core::interning::InternedString;
|
||||
use core::source::SourceId;
|
||||
use util::{CargoResult, ToSemver};
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::source::SourceId;
|
||||
use crate::util::{CargoResult, ToSemver};
|
||||
|
||||
lazy_static! {
|
||||
static ref PACKAGE_ID_CACHE: Mutex<HashSet<&'static PackageIdInner>> =
|
||||
|
@ -202,9 +202,9 @@ impl fmt::Debug for PackageId {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::PackageId;
|
||||
use core::source::SourceId;
|
||||
use sources::CRATES_IO_INDEX;
|
||||
use util::ToUrl;
|
||||
use crate::core::source::SourceId;
|
||||
use crate::sources::CRATES_IO_INDEX;
|
||||
use crate::util::ToUrl;
|
||||
|
||||
#[test]
|
||||
fn invalid_version_handled_nicely() {
|
||||
|
|
|
@ -5,9 +5,9 @@ use semver::Version;
|
|||
use serde::{de, ser};
|
||||
use url::Url;
|
||||
|
||||
use core::PackageId;
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::{ToSemver, ToUrl};
|
||||
use crate::core::PackageId;
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::{ToSemver, ToUrl};
|
||||
|
||||
/// Some or all of the data required to identify a package:
|
||||
///
|
||||
|
@ -277,7 +277,7 @@ impl<'de> de::Deserialize<'de> for PackageIdSpec {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::PackageIdSpec;
|
||||
use core::{PackageId, SourceId};
|
||||
use crate::core::{PackageId, SourceId};
|
||||
use semver::Version;
|
||||
use url::Url;
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
use std::collections::HashSet;
|
||||
use std::{cmp, fmt, hash};
|
||||
|
||||
use core::compiler::CompileMode;
|
||||
use core::interning::InternedString;
|
||||
use core::{Features, PackageId, PackageIdSpec, PackageSet, Shell};
|
||||
use util::errors::CargoResultExt;
|
||||
use util::lev_distance::lev_distance;
|
||||
use util::toml::{ProfilePackageSpec, StringOrBool, TomlProfile, TomlProfiles, U32OrBool};
|
||||
use util::{CargoResult, Config};
|
||||
use crate::core::compiler::CompileMode;
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::{Features, PackageId, PackageIdSpec, PackageSet, Shell};
|
||||
use crate::util::errors::CargoResultExt;
|
||||
use crate::util::lev_distance::lev_distance;
|
||||
use crate::util::toml::{ProfilePackageSpec, StringOrBool, TomlProfile, TomlProfiles, U32OrBool};
|
||||
use crate::util::{CargoResult, Config};
|
||||
|
||||
/// Collection of all user profiles.
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
|
@ -3,11 +3,11 @@ use std::collections::HashMap;
|
|||
use semver::VersionReq;
|
||||
use url::Url;
|
||||
|
||||
use core::PackageSet;
|
||||
use core::{Dependency, PackageId, Source, SourceId, SourceMap, Summary};
|
||||
use sources::config::SourceConfigMap;
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::{profile, Config};
|
||||
use crate::core::PackageSet;
|
||||
use crate::core::{Dependency, PackageId, Source, SourceId, SourceMap, Summary};
|
||||
use crate::sources::config::SourceConfigMap;
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::{profile, Config};
|
||||
|
||||
/// Source of information about a group of packages.
|
||||
///
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||
|
||||
use super::types::ConflictReason;
|
||||
use core::resolver::Context;
|
||||
use core::{Dependency, PackageId};
|
||||
use crate::core::resolver::Context;
|
||||
use crate::core::{Dependency, PackageId};
|
||||
|
||||
/// This is a Trie for storing a large number of Sets designed to
|
||||
/// efficiently see if any of the stored Sets are a subset of a search Set.
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||
use std::rc::Rc;
|
||||
|
||||
use core::interning::InternedString;
|
||||
use core::{Dependency, FeatureValue, PackageId, SourceId, Summary};
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::{Dependency, FeatureValue, PackageId, SourceId, Summary};
|
||||
use im_rc;
|
||||
use util::CargoResult;
|
||||
use util::Graph;
|
||||
use crate::util::CargoResult;
|
||||
use crate::util::Graph;
|
||||
|
||||
use super::errors::ActivateResult;
|
||||
use super::types::{ConflictReason, DepInfo, GraphNode, Method, RcList, RegistryQueryer};
|
||||
|
|
|
@ -5,9 +5,9 @@ use std::str::FromStr;
|
|||
use serde::de;
|
||||
use serde::ser;
|
||||
|
||||
use core::{Dependency, Package, PackageId, SourceId, Workspace};
|
||||
use util::errors::{CargoError, CargoResult, CargoResultExt};
|
||||
use util::{internal, Graph};
|
||||
use crate::core::{Dependency, Package, PackageId, SourceId, Workspace};
|
||||
use crate::util::errors::{CargoError, CargoResult, CargoResultExt};
|
||||
use crate::util::{internal, Graph};
|
||||
|
||||
use super::Resolve;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use std::collections::BTreeMap;
|
||||
use std::fmt;
|
||||
|
||||
use core::{Dependency, PackageId, Registry, Summary};
|
||||
use crate::core::{Dependency, PackageId, Registry, Summary};
|
||||
use failure::{Error, Fail};
|
||||
use semver;
|
||||
use util::lev_distance::lev_distance;
|
||||
use util::{CargoError, Config};
|
||||
use crate::util::lev_distance::lev_distance;
|
||||
use crate::util::{CargoError, Config};
|
||||
|
||||
use super::context::Context;
|
||||
use super::types::{Candidate, ConflictReason};
|
||||
|
|
|
@ -54,12 +54,12 @@ use std::time::{Duration, Instant};
|
|||
|
||||
use semver;
|
||||
|
||||
use core::interning::InternedString;
|
||||
use core::PackageIdSpec;
|
||||
use core::{Dependency, PackageId, Registry, Summary};
|
||||
use util::config::Config;
|
||||
use util::errors::CargoResult;
|
||||
use util::profile;
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::PackageIdSpec;
|
||||
use crate::core::{Dependency, PackageId, Registry, Summary};
|
||||
use crate::util::config::Config;
|
||||
use crate::util::errors::CargoResult;
|
||||
use crate::util::profile;
|
||||
|
||||
use self::context::{Activations, Context};
|
||||
use self::types::{Candidate, ConflictReason, DepsFrame, GraphNode};
|
||||
|
|
|
@ -6,9 +6,9 @@ use std::iter::FromIterator;
|
|||
|
||||
use url::Url;
|
||||
|
||||
use core::{Dependency, PackageId, PackageIdSpec, Summary, Target};
|
||||
use util::errors::CargoResult;
|
||||
use util::Graph;
|
||||
use crate::core::{Dependency, PackageId, PackageIdSpec, Summary, Target};
|
||||
use crate::util::errors::CargoResult;
|
||||
use crate::util::Graph;
|
||||
|
||||
use super::encode::Metadata;
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ use std::ops::Range;
|
|||
use std::rc::Rc;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use core::interning::InternedString;
|
||||
use core::{Dependency, PackageId, PackageIdSpec, Registry, Summary};
|
||||
use util::errors::CargoResult;
|
||||
use util::Config;
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::{Dependency, PackageId, PackageIdSpec, Registry, Summary};
|
||||
use crate::util::errors::CargoResult;
|
||||
use crate::util::Config;
|
||||
|
||||
use im_rc;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use atty;
|
|||
use termcolor::Color::{Cyan, Green, Red, Yellow};
|
||||
use termcolor::{self, Color, ColorSpec, StandardStream, WriteColor};
|
||||
|
||||
use util::errors::CargoResult;
|
||||
use crate::util::errors::CargoResult;
|
||||
|
||||
/// The requested verbosity of output
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use std::collections::hash_map::HashMap;
|
||||
use std::fmt;
|
||||
|
||||
use core::{Dependency, Package, PackageId, Summary};
|
||||
use util::CargoResult;
|
||||
use crate::core::{Dependency, Package, PackageId, Summary};
|
||||
use crate::util::CargoResult;
|
||||
|
||||
mod source_id;
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ use serde::de;
|
|||
use serde::ser;
|
||||
use url::Url;
|
||||
|
||||
use ops;
|
||||
use sources::git;
|
||||
use sources::DirectorySource;
|
||||
use sources::{GitSource, PathSource, RegistrySource, CRATES_IO_INDEX};
|
||||
use util::{CargoResult, Config, ToUrl};
|
||||
use crate::ops;
|
||||
use crate::sources::git;
|
||||
use crate::sources::DirectorySource;
|
||||
use crate::sources::{GitSource, PathSource, RegistrySource, CRATES_IO_INDEX};
|
||||
use crate::util::{CargoResult, Config, ToUrl};
|
||||
|
||||
lazy_static! {
|
||||
static ref SOURCE_ID_CACHE: Mutex<HashSet<&'static SourceIdInner>> = Mutex::new(HashSet::new());
|
||||
|
@ -579,7 +579,7 @@ impl<'a> fmt::Display for PrettyRef<'a> {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{GitReference, Kind, SourceId};
|
||||
use util::ToUrl;
|
||||
use crate::util::ToUrl;
|
||||
|
||||
#[test]
|
||||
fn github_sources_equal() {
|
||||
|
|
|
@ -6,11 +6,11 @@ use std::rc::Rc;
|
|||
|
||||
use serde::{Serialize, Serializer};
|
||||
|
||||
use core::interning::InternedString;
|
||||
use core::{Dependency, PackageId, SourceId};
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::{Dependency, PackageId, SourceId};
|
||||
use semver::Version;
|
||||
|
||||
use util::CargoResult;
|
||||
use crate::util::CargoResult;
|
||||
|
||||
/// Subset of a `Manifest`. Contains only the most important information about
|
||||
/// a package.
|
||||
|
|
|
@ -7,16 +7,16 @@ use std::slice;
|
|||
use glob::glob;
|
||||
use url::Url;
|
||||
|
||||
use core::profiles::Profiles;
|
||||
use core::registry::PackageRegistry;
|
||||
use core::{Dependency, PackageIdSpec};
|
||||
use core::{EitherManifest, Package, SourceId, VirtualManifest};
|
||||
use ops;
|
||||
use sources::PathSource;
|
||||
use util::errors::{CargoResult, CargoResultExt, ManifestError};
|
||||
use util::paths;
|
||||
use util::toml::read_manifest;
|
||||
use util::{Config, Filesystem};
|
||||
use crate::core::profiles::Profiles;
|
||||
use crate::core::registry::PackageRegistry;
|
||||
use crate::core::{Dependency, PackageIdSpec};
|
||||
use crate::core::{EitherManifest, Package, SourceId, VirtualManifest};
|
||||
use crate::ops;
|
||||
use crate::sources::PathSource;
|
||||
use crate::util::errors::{CargoResult, CargoResultExt, ManifestError};
|
||||
use crate::util::paths;
|
||||
use crate::util::toml::read_manifest;
|
||||
use crate::util::{Config, Filesystem};
|
||||
|
||||
/// The core abstraction in Cargo for working with a workspace of crates.
|
||||
///
|
||||
|
|
|
@ -68,11 +68,11 @@ use std::fmt;
|
|||
use failure::Error;
|
||||
use serde::ser;
|
||||
|
||||
use core::shell::Verbosity::Verbose;
|
||||
use core::Shell;
|
||||
use crate::core::shell::Verbosity::Verbose;
|
||||
use crate::core::Shell;
|
||||
|
||||
pub use util::errors::Internal;
|
||||
pub use util::{CargoError, CargoResult, CliError, CliResult, Config};
|
||||
pub use crate::util::errors::Internal;
|
||||
pub use crate::util::{CargoError, CargoResult, CliError, CliResult, Config};
|
||||
|
||||
pub const CARGO_ENV: &str = "CARGO";
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ macro_rules! compact_debug {
|
|||
)*
|
||||
|
||||
if any_default {
|
||||
s.field("..", &::macros::DisplayAsDebug(default_name));
|
||||
s.field("..", &crate::macros::DisplayAsDebug(default_name));
|
||||
}
|
||||
s.finish()
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ use std::collections::HashMap;
|
|||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
use core::compiler::{BuildConfig, BuildContext, CompileMode, Context, Kind, Unit};
|
||||
use core::profiles::UnitFor;
|
||||
use core::Workspace;
|
||||
use ops;
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::paths;
|
||||
use util::Config;
|
||||
use crate::core::compiler::{BuildConfig, BuildContext, CompileMode, Context, Kind, Unit};
|
||||
use crate::core::profiles::UnitFor;
|
||||
use crate::core::Workspace;
|
||||
use crate::ops;
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::paths;
|
||||
use crate::util::Config;
|
||||
|
||||
pub struct CleanOptions<'a> {
|
||||
pub config: &'a Config,
|
||||
|
|
|
@ -26,15 +26,15 @@ use std::collections::{HashMap, HashSet};
|
|||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use core::compiler::{BuildConfig, BuildContext, Compilation, Context, DefaultExecutor, Executor};
|
||||
use core::compiler::{CompileMode, Kind, Unit};
|
||||
use core::profiles::{Profiles, UnitFor};
|
||||
use core::resolver::{Method, Resolve};
|
||||
use core::{Package, Source, Target};
|
||||
use core::{PackageId, PackageIdSpec, TargetKind, Workspace};
|
||||
use ops;
|
||||
use util::config::Config;
|
||||
use util::{lev_distance, profile, CargoResult};
|
||||
use crate::core::compiler::{BuildConfig, BuildContext, Compilation, Context, DefaultExecutor, Executor};
|
||||
use crate::core::compiler::{CompileMode, Kind, Unit};
|
||||
use crate::core::profiles::{Profiles, UnitFor};
|
||||
use crate::core::resolver::{Method, Resolve};
|
||||
use crate::core::{Package, Source, Target};
|
||||
use crate::core::{PackageId, PackageIdSpec, TargetKind, Workspace};
|
||||
use crate::ops;
|
||||
use crate::util::config::Config;
|
||||
use crate::util::{lev_distance, profile, CargoResult};
|
||||
|
||||
/// Contains information about how a package should be compiled.
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -5,9 +5,9 @@ use std::path::Path;
|
|||
use failure::Fail;
|
||||
use opener;
|
||||
|
||||
use core::Workspace;
|
||||
use ops;
|
||||
use util::CargoResult;
|
||||
use crate::core::Workspace;
|
||||
use crate::ops;
|
||||
use crate::util::CargoResult;
|
||||
|
||||
/// Strongly typed options for the `cargo doc` command.
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use core::compiler::{BuildConfig, CompileMode, Kind, TargetInfo};
|
||||
use core::{PackageSet, Resolve, Workspace};
|
||||
use ops;
|
||||
use crate::core::compiler::{BuildConfig, CompileMode, Kind, TargetInfo};
|
||||
use crate::core::{PackageSet, Resolve, Workspace};
|
||||
use crate::ops;
|
||||
use std::collections::HashSet;
|
||||
use util::CargoResult;
|
||||
use util::Config;
|
||||
use crate::util::CargoResult;
|
||||
use crate::util::Config;
|
||||
|
||||
pub struct FetchOptions<'a> {
|
||||
pub config: &'a Config,
|
||||
|
|
|
@ -2,13 +2,13 @@ use std::collections::{BTreeMap, HashSet};
|
|||
|
||||
use termcolor::Color::{self, Cyan, Green, Red};
|
||||
|
||||
use core::registry::PackageRegistry;
|
||||
use core::resolver::Method;
|
||||
use core::PackageId;
|
||||
use core::{Resolve, SourceId, Workspace};
|
||||
use ops;
|
||||
use util::config::Config;
|
||||
use util::CargoResult;
|
||||
use crate::core::registry::PackageRegistry;
|
||||
use crate::core::resolver::Method;
|
||||
use crate::core::PackageId;
|
||||
use crate::core::{Resolve, SourceId, Workspace};
|
||||
use crate::ops;
|
||||
use crate::util::config::Config;
|
||||
use crate::util::CargoResult;
|
||||
|
||||
pub struct UpdateOptions<'a> {
|
||||
pub config: &'a Config,
|
||||
|
|
|
@ -10,17 +10,17 @@ use semver::{Version, VersionReq};
|
|||
use tempfile::Builder as TempFileBuilder;
|
||||
use toml;
|
||||
|
||||
use core::compiler::{DefaultExecutor, Executor};
|
||||
use core::package::PackageSet;
|
||||
use core::source::SourceMap;
|
||||
use core::{Dependency, Edition, Package, PackageIdSpec, Source, SourceId};
|
||||
use core::{PackageId, Workspace};
|
||||
use ops::{self, CompileFilter};
|
||||
use sources::{GitSource, PathSource, SourceConfigMap};
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::paths;
|
||||
use util::{internal, Config};
|
||||
use util::{FileLock, Filesystem};
|
||||
use crate::core::compiler::{DefaultExecutor, Executor};
|
||||
use crate::core::package::PackageSet;
|
||||
use crate::core::source::SourceMap;
|
||||
use crate::core::{Dependency, Edition, Package, PackageIdSpec, Source, SourceId};
|
||||
use crate::core::{PackageId, Workspace};
|
||||
use crate::ops::{self, CompileFilter};
|
||||
use crate::sources::{GitSource, PathSource, SourceConfigMap};
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::paths;
|
||||
use crate::util::{internal, Config};
|
||||
use crate::util::{FileLock, Filesystem};
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[serde(untagged)]
|
||||
|
@ -101,7 +101,7 @@ pub fn install(
|
|||
) {
|
||||
Ok(()) => succeeded.push(krate),
|
||||
Err(e) => {
|
||||
::handle_error(&e, &mut opts.config.shell());
|
||||
crate::handle_error(&e, &mut opts.config.shell());
|
||||
failed.push(krate)
|
||||
}
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ pub fn uninstall(
|
|||
match uninstall_one(&root, spec, bins, config) {
|
||||
Ok(()) => succeeded.push(spec),
|
||||
Err(e) => {
|
||||
::handle_error(&e, &mut config.shell());
|
||||
crate::handle_error(&e, &mut config.shell());
|
||||
failed.push(spec)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@ use std::path::{Path, PathBuf};
|
|||
use git2::Config as GitConfig;
|
||||
use git2::Repository as GitRepository;
|
||||
|
||||
use core::{compiler, Workspace};
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::{existing_vcs_repo, internal, FossilRepo, GitRepo, HgRepo, PijulRepo};
|
||||
use util::{paths, Config};
|
||||
use crate::core::{compiler, Workspace};
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::{existing_vcs_repo, internal, FossilRepo, GitRepo, HgRepo, PijulRepo};
|
||||
use crate::util::{paths, Config};
|
||||
|
||||
use toml;
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ use std::collections::HashMap;
|
|||
|
||||
use serde::ser;
|
||||
|
||||
use core::resolver::Resolve;
|
||||
use core::{Package, PackageId, Workspace};
|
||||
use ops::{self, Packages};
|
||||
use util::CargoResult;
|
||||
use crate::core::resolver::Resolve;
|
||||
use crate::core::{Package, PackageId, Workspace};
|
||||
use crate::ops::{self, Packages};
|
||||
use crate::util::CargoResult;
|
||||
|
||||
const VERSION: u32 = 1;
|
||||
|
||||
|
|
|
@ -10,13 +10,13 @@ use git2;
|
|||
use serde_json;
|
||||
use tar::{Archive, Builder, EntryType, Header};
|
||||
|
||||
use core::compiler::{BuildConfig, CompileMode, DefaultExecutor, Executor};
|
||||
use core::{Package, Source, SourceId, Workspace};
|
||||
use ops;
|
||||
use sources::PathSource;
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::paths;
|
||||
use util::{self, internal, Config, FileLock};
|
||||
use crate::core::compiler::{BuildConfig, CompileMode, DefaultExecutor, Executor};
|
||||
use crate::core::{Package, Source, SourceId, Workspace};
|
||||
use crate::ops;
|
||||
use crate::sources::PathSource;
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::paths;
|
||||
use crate::util::{self, internal, Config, FileLock};
|
||||
|
||||
pub struct PackageOpts<'cfg> {
|
||||
pub config: &'cfg Config,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use core::{PackageIdSpec, Workspace};
|
||||
use ops;
|
||||
use util::CargoResult;
|
||||
use crate::core::{PackageIdSpec, Workspace};
|
||||
use crate::ops;
|
||||
use crate::util::CargoResult;
|
||||
|
||||
pub fn pkgid(ws: &Workspace, spec: Option<&str>) -> CargoResult<PackageIdSpec> {
|
||||
let resolve = match ops::load_pkg_lockfile(ws)? {
|
||||
|
|
|
@ -3,11 +3,11 @@ use std::fs;
|
|||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use core::{EitherManifest, Package, PackageId, SourceId};
|
||||
use util::errors::{CargoError, CargoResult};
|
||||
use util::important_paths::find_project_manifest_exact;
|
||||
use util::toml::read_manifest;
|
||||
use util::{self, Config};
|
||||
use crate::core::{EitherManifest, Package, PackageId, SourceId};
|
||||
use crate::util::errors::{CargoError, CargoResult};
|
||||
use crate::util::important_paths::find_project_manifest_exact;
|
||||
use crate::util::toml::read_manifest;
|
||||
use crate::util::{self, Config};
|
||||
|
||||
pub fn read_package(
|
||||
path: &Path,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use std::iter;
|
||||
use std::path::Path;
|
||||
|
||||
use ops;
|
||||
use util::{self, CargoResult, ProcessError};
|
||||
use core::{TargetKind, Workspace, nightly_features_allowed};
|
||||
use crate::ops;
|
||||
use crate::util::{self, CargoResult, ProcessError};
|
||||
use crate::core::{TargetKind, Workspace, nightly_features_allowed};
|
||||
|
||||
pub fn run(
|
||||
ws: &Workspace,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use std::ffi::OsString;
|
||||
|
||||
use core::compiler::{Compilation, Doctest};
|
||||
use core::Workspace;
|
||||
use ops;
|
||||
use util::errors::CargoResult;
|
||||
use util::{self, CargoTestError, ProcessError, Test};
|
||||
use crate::core::compiler::{Compilation, Doctest};
|
||||
use crate::core::Workspace;
|
||||
use crate::ops;
|
||||
use crate::util::errors::CargoResult;
|
||||
use crate::util::{self, CargoTestError, ProcessError, Test};
|
||||
|
||||
pub struct TestOptions<'a> {
|
||||
pub compile_opts: ops::CompileOptions<'a>,
|
||||
|
|
|
@ -12,12 +12,12 @@ use rustfix::diagnostics::Diagnostic;
|
|||
use rustfix::{self, CodeFix};
|
||||
use serde_json;
|
||||
|
||||
use core::Workspace;
|
||||
use ops::{self, CompileOptions};
|
||||
use util::diagnostic_server::{Message, RustfixDiagnosticServer};
|
||||
use util::errors::CargoResult;
|
||||
use util::paths;
|
||||
use util::{existing_vcs_repo, LockServer, LockServerClient};
|
||||
use crate::core::Workspace;
|
||||
use crate::ops::{self, CompileOptions};
|
||||
use crate::util::diagnostic_server::{Message, RustfixDiagnosticServer};
|
||||
use crate::util::errors::CargoResult;
|
||||
use crate::util::paths;
|
||||
use crate::util::{existing_vcs_repo, LockServer, LockServerClient};
|
||||
|
||||
const FIX_ENV: &str = "__CARGO_FIX_PLZ";
|
||||
const BROKEN_CODE_ENV: &str = "__CARGO_FIX_BROKEN_CODE";
|
||||
|
|
|
@ -2,11 +2,11 @@ use std::io::prelude::*;
|
|||
|
||||
use toml;
|
||||
|
||||
use core::resolver::WorkspaceResolve;
|
||||
use core::{resolver, Resolve, Workspace};
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::toml as cargo_toml;
|
||||
use util::Filesystem;
|
||||
use crate::core::resolver::WorkspaceResolve;
|
||||
use crate::core::{resolver, Resolve, Workspace};
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::toml as cargo_toml;
|
||||
use crate::util::Filesystem;
|
||||
|
||||
pub fn load_pkg_lockfile(ws: &Workspace) -> CargoResult<Option<Resolve>> {
|
||||
if !ws.root().join("Cargo.lock").exists() {
|
||||
|
|
|
@ -8,22 +8,22 @@ use std::{cmp, env};
|
|||
use curl::easy::{Easy, InfoType, SslOpt};
|
||||
use git2;
|
||||
use log::Level;
|
||||
use registry::{NewCrate, NewCrateDependency, Registry};
|
||||
use crate::registry::{NewCrate, NewCrateDependency, Registry};
|
||||
|
||||
use url::percent_encoding::{percent_encode, QUERY_ENCODE_SET};
|
||||
|
||||
use core::dependency::Kind;
|
||||
use core::manifest::ManifestMetadata;
|
||||
use core::source::Source;
|
||||
use core::{Package, SourceId, Workspace};
|
||||
use ops;
|
||||
use sources::{RegistrySource, SourceConfigMap};
|
||||
use util::config::{self, Config};
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::important_paths::find_root_manifest_for_wd;
|
||||
use util::paths;
|
||||
use util::ToUrl;
|
||||
use version;
|
||||
use crate::core::dependency::Kind;
|
||||
use crate::core::manifest::ManifestMetadata;
|
||||
use crate::core::source::Source;
|
||||
use crate::core::{Package, SourceId, Workspace};
|
||||
use crate::ops;
|
||||
use crate::sources::{RegistrySource, SourceConfigMap};
|
||||
use crate::util::config::{self, Config};
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::important_paths::find_root_manifest_for_wd;
|
||||
use crate::util::paths;
|
||||
use crate::util::ToUrl;
|
||||
use crate::version;
|
||||
|
||||
pub struct RegistryConfig {
|
||||
pub index: Option<String>,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use std::collections::HashSet;
|
||||
|
||||
use core::registry::PackageRegistry;
|
||||
use core::resolver::{self, Method, Resolve};
|
||||
use core::{PackageId, PackageIdSpec, PackageSet, Source, SourceId, Workspace};
|
||||
use ops;
|
||||
use sources::PathSource;
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::profile;
|
||||
use crate::core::registry::PackageRegistry;
|
||||
use crate::core::resolver::{self, Method, Resolve};
|
||||
use crate::core::{PackageId, PackageIdSpec, PackageSet, Source, SourceId, Workspace};
|
||||
use crate::ops;
|
||||
use crate::sources::PathSource;
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::profile;
|
||||
|
||||
/// Resolve all dependencies for the workspace using the previous
|
||||
/// lockfile as a guide if present.
|
||||
|
|
|
@ -9,11 +9,11 @@ use std::path::{Path, PathBuf};
|
|||
|
||||
use url::Url;
|
||||
|
||||
use core::{GitReference, Source, SourceId};
|
||||
use sources::{ReplacedSource, CRATES_IO_REGISTRY};
|
||||
use util::config::ConfigValue;
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::{Config, ToUrl};
|
||||
use crate::core::{GitReference, Source, SourceId};
|
||||
use crate::sources::{ReplacedSource, CRATES_IO_REGISTRY};
|
||||
use crate::util::config::ConfigValue;
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::{Config, ToUrl};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SourceConfigMap<'cfg> {
|
||||
|
@ -176,7 +176,7 @@ restore the source replacement configuration to continue the build
|
|||
}
|
||||
if let Some(val) = table.get("git") {
|
||||
let url = url(val, &format!("source.{}.git", name))?;
|
||||
let try = |s: &str| {
|
||||
let r#try = |s: &str| {
|
||||
let val = match table.get(s) {
|
||||
Some(s) => s,
|
||||
None => return Ok(None),
|
||||
|
@ -184,11 +184,11 @@ restore the source replacement configuration to continue the build
|
|||
let key = format!("source.{}.{}", name, s);
|
||||
val.string(&key).map(Some)
|
||||
};
|
||||
let reference = match try("branch")? {
|
||||
let reference = match r#try("branch")? {
|
||||
Some(b) => GitReference::Branch(b.0.to_string()),
|
||||
None => match try("tag")? {
|
||||
None => match r#try("tag")? {
|
||||
Some(b) => GitReference::Tag(b.0.to_string()),
|
||||
None => match try("rev")? {
|
||||
None => match r#try("rev")? {
|
||||
Some(b) => GitReference::Rev(b.0.to_string()),
|
||||
None => GitReference::Branch("master".to_string()),
|
||||
},
|
||||
|
|
|
@ -8,12 +8,12 @@ use hex;
|
|||
|
||||
use serde_json;
|
||||
|
||||
use core::source::MaybePackage;
|
||||
use core::{Dependency, Package, PackageId, Source, SourceId, Summary};
|
||||
use sources::PathSource;
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::paths;
|
||||
use util::{Config, Sha256};
|
||||
use crate::core::source::MaybePackage;
|
||||
use crate::core::{Dependency, Package, PackageId, Source, SourceId, Summary};
|
||||
use crate::sources::PathSource;
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::paths;
|
||||
use crate::util::{Config, Sha256};
|
||||
|
||||
pub struct DirectorySource<'cfg> {
|
||||
source_id: SourceId,
|
||||
|
|
|
@ -2,14 +2,14 @@ use std::fmt::{self, Debug, Formatter};
|
|||
|
||||
use url::Url;
|
||||
|
||||
use core::source::{MaybePackage, Source, SourceId};
|
||||
use core::GitReference;
|
||||
use core::{Dependency, Package, PackageId, Summary};
|
||||
use sources::git::utils::{GitRemote, GitRevision};
|
||||
use sources::PathSource;
|
||||
use util::errors::CargoResult;
|
||||
use util::hex::short_hash;
|
||||
use util::Config;
|
||||
use crate::core::source::{MaybePackage, Source, SourceId};
|
||||
use crate::core::GitReference;
|
||||
use crate::core::{Dependency, Package, PackageId, Summary};
|
||||
use crate::sources::git::utils::{GitRemote, GitRevision};
|
||||
use crate::sources::PathSource;
|
||||
use crate::util::errors::CargoResult;
|
||||
use crate::util::hex::short_hash;
|
||||
use crate::util::Config;
|
||||
|
||||
pub struct GitSource<'cfg> {
|
||||
remote: GitRemote,
|
||||
|
@ -243,7 +243,7 @@ impl<'cfg> Source for GitSource<'cfg> {
|
|||
mod test {
|
||||
use super::ident;
|
||||
use url::Url;
|
||||
use util::ToUrl;
|
||||
use crate::util::ToUrl;
|
||||
|
||||
#[test]
|
||||
pub fn test_url_to_path_ident_with_path() {
|
||||
|
|
|
@ -10,11 +10,11 @@ use git2::{self, ObjectType};
|
|||
use serde::ser;
|
||||
use url::Url;
|
||||
|
||||
use core::GitReference;
|
||||
use util::errors::{CargoError, CargoResult, CargoResultExt};
|
||||
use util::paths;
|
||||
use util::process_builder::process;
|
||||
use util::{internal, network, Config, Progress, ToUrl};
|
||||
use crate::core::GitReference;
|
||||
use crate::util::errors::{CargoError, CargoResult, CargoResultExt};
|
||||
use crate::util::paths;
|
||||
use crate::util::process_builder::process;
|
||||
use crate::util::{internal, network, Config, Progress, ToUrl};
|
||||
|
||||
#[derive(PartialEq, Clone, Debug)]
|
||||
pub struct GitRevision(git2::Oid);
|
||||
|
@ -875,7 +875,7 @@ fn init(path: &Path, bare: bool) -> CargoResult<git2::Repository> {
|
|||
/// just return a `bool`. Any real errors will be reported through the normal
|
||||
/// update path above.
|
||||
fn github_up_to_date(handle: &mut Easy, url: &Url, oid: &git2::Oid) -> bool {
|
||||
macro_rules! try {
|
||||
macro_rules! r#try {
|
||||
($e:expr) => (match $e {
|
||||
Some(e) => e,
|
||||
None => return false,
|
||||
|
@ -884,9 +884,9 @@ fn github_up_to_date(handle: &mut Easy, url: &Url, oid: &git2::Oid) -> bool {
|
|||
|
||||
// This expects GitHub urls in the form `github.com/user/repo` and nothing
|
||||
// else
|
||||
let mut pieces = try!(url.path_segments());
|
||||
let username = try!(pieces.next());
|
||||
let repo = try!(pieces.next());
|
||||
let mut pieces = r#try!(url.path_segments());
|
||||
let username = r#try!(pieces.next());
|
||||
let repo = r#try!(pieces.next());
|
||||
if pieces.next().is_some() {
|
||||
return false;
|
||||
}
|
||||
|
@ -895,14 +895,14 @@ fn github_up_to_date(handle: &mut Easy, url: &Url, oid: &git2::Oid) -> bool {
|
|||
"https://api.github.com/repos/{}/{}/commits/master",
|
||||
username, repo
|
||||
);
|
||||
try!(handle.get(true).ok());
|
||||
try!(handle.url(&url).ok());
|
||||
try!(handle.useragent("cargo").ok());
|
||||
r#try!(handle.get(true).ok());
|
||||
r#try!(handle.url(&url).ok());
|
||||
r#try!(handle.useragent("cargo").ok());
|
||||
let mut headers = List::new();
|
||||
try!(headers.append("Accept: application/vnd.github.3.sha").ok());
|
||||
try!(headers.append(&format!("If-None-Match: \"{}\"", oid)).ok());
|
||||
try!(handle.http_headers(headers).ok());
|
||||
try!(handle.perform().ok());
|
||||
r#try!(headers.append("Accept: application/vnd.github.3.sha").ok());
|
||||
r#try!(headers.append(&format!("If-None-Match: \"{}\"", oid)).ok());
|
||||
r#try!(handle.http_headers(headers).ok());
|
||||
r#try!(handle.perform().ok());
|
||||
|
||||
try!(handle.response_code().ok()) == 304
|
||||
r#try!(handle.response_code().ok()) == 304
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@ use glob::Pattern;
|
|||
use ignore::gitignore::GitignoreBuilder;
|
||||
use ignore::Match;
|
||||
|
||||
use core::source::MaybePackage;
|
||||
use core::{Dependency, Package, PackageId, Source, SourceId, Summary};
|
||||
use ops;
|
||||
use util::paths;
|
||||
use util::Config;
|
||||
use util::{self, internal, CargoResult};
|
||||
use crate::core::source::MaybePackage;
|
||||
use crate::core::{Dependency, Package, PackageId, Source, SourceId, Summary};
|
||||
use crate::ops;
|
||||
use crate::util::paths;
|
||||
use crate::util::Config;
|
||||
use crate::util::{self, internal, CargoResult};
|
||||
|
||||
pub struct PathSource<'cfg> {
|
||||
source_id: SourceId,
|
||||
|
|
|
@ -5,11 +5,11 @@ use std::str;
|
|||
use semver::Version;
|
||||
use serde_json;
|
||||
|
||||
use core::dependency::Dependency;
|
||||
use core::{PackageId, SourceId, Summary};
|
||||
use sources::registry::RegistryData;
|
||||
use sources::registry::{RegistryPackage, INDEX_LOCK};
|
||||
use util::{internal, CargoResult, Config, Filesystem};
|
||||
use crate::core::dependency::Dependency;
|
||||
use crate::core::{PackageId, SourceId, Summary};
|
||||
use crate::sources::registry::RegistryData;
|
||||
use crate::sources::registry::{RegistryPackage, INDEX_LOCK};
|
||||
use crate::util::{internal, CargoResult, Config, Filesystem};
|
||||
|
||||
/// Crates.io treats hyphen and underscores as interchangeable
|
||||
/// but, the index and old cargo do not. So the index must store uncanonicalized version
|
||||
|
|
|
@ -2,12 +2,12 @@ use std::io::prelude::*;
|
|||
use std::io::SeekFrom;
|
||||
use std::path::Path;
|
||||
|
||||
use core::PackageId;
|
||||
use crate::core::PackageId;
|
||||
use hex;
|
||||
use sources::registry::{MaybeLock, RegistryConfig, RegistryData};
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::paths;
|
||||
use util::{Config, FileLock, Filesystem, Sha256};
|
||||
use crate::sources::registry::{MaybeLock, RegistryConfig, RegistryData};
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::paths;
|
||||
use crate::util::{Config, FileLock, Filesystem, Sha256};
|
||||
|
||||
pub struct LocalRegistry<'cfg> {
|
||||
index_path: Filesystem,
|
||||
|
|
|
@ -169,14 +169,14 @@ use semver::Version;
|
|||
use serde_json;
|
||||
use tar::Archive;
|
||||
|
||||
use core::dependency::{Dependency, Kind};
|
||||
use core::source::MaybePackage;
|
||||
use core::{Package, PackageId, Source, SourceId, Summary};
|
||||
use sources::PathSource;
|
||||
use util::errors::CargoResultExt;
|
||||
use util::hex;
|
||||
use util::to_url::ToUrl;
|
||||
use util::{internal, CargoResult, Config, FileLock, Filesystem};
|
||||
use crate::core::dependency::{Dependency, Kind};
|
||||
use crate::core::source::MaybePackage;
|
||||
use crate::core::{Package, PackageId, Source, SourceId, Summary};
|
||||
use crate::sources::PathSource;
|
||||
use crate::util::errors::CargoResultExt;
|
||||
use crate::util::hex;
|
||||
use crate::util::to_url::ToUrl;
|
||||
use crate::util::{internal, CargoResult, Config, FileLock, Filesystem};
|
||||
|
||||
const INDEX_LOCK: &str = ".cargo-index-lock";
|
||||
pub const CRATES_IO_INDEX: &str = "https://github.com/rust-lang/crates.io-index";
|
||||
|
|
|
@ -11,15 +11,15 @@ use hex;
|
|||
use lazycell::LazyCell;
|
||||
use serde_json;
|
||||
|
||||
use core::{PackageId, SourceId};
|
||||
use sources::git;
|
||||
use sources::registry::MaybeLock;
|
||||
use sources::registry::{
|
||||
use crate::core::{PackageId, SourceId};
|
||||
use crate::sources::git;
|
||||
use crate::sources::registry::MaybeLock;
|
||||
use crate::sources::registry::{
|
||||
RegistryConfig, RegistryData, CRATE_TEMPLATE, INDEX_LOCK, VERSION_TEMPLATE,
|
||||
};
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use util::{Config, Sha256};
|
||||
use util::{FileLock, Filesystem};
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::util::{Config, Sha256};
|
||||
use crate::util::{FileLock, Filesystem};
|
||||
|
||||
pub struct RemoteRegistry<'cfg> {
|
||||
index_path: Filesystem,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use core::source::MaybePackage;
|
||||
use core::{Dependency, Package, PackageId, Source, SourceId, Summary};
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
use crate::core::source::MaybePackage;
|
||||
use crate::core::{Dependency, Package, PackageId, Source, SourceId, Summary};
|
||||
use crate::util::errors::{CargoResult, CargoResultExt};
|
||||
|
||||
pub struct ReplacedSource<'cfg> {
|
||||
to_replace: SourceId,
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue