mirror of
https://github.com/rust-lang/cargo
synced 2024-08-28 11:50:23 +00:00
Start using 2018 idioms in Cargo
Remove a number of `extern crate` directives and tweak a number of imports. Not all `extern crate` is gone yet but this is the bulk of them!
This commit is contained in:
parent
2cf1f5dda2
commit
9ed82b5779
|
@ -48,8 +48,7 @@ opener = "0.3.0"
|
|||
rustfix = "0.4.2"
|
||||
same-file = "1"
|
||||
semver = { version = "0.9.0", features = ["serde"] }
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde = { version = "1.0", features = ['derive'] }
|
||||
serde_ignored = "0.0.4"
|
||||
serde_json = { version = "1.0.30", features = ["raw_value"] }
|
||||
shell-escape = "0.1.4"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use crate::command_prelude::*;
|
||||
|
||||
use cargo::print_json;
|
||||
use serde::Serialize;
|
||||
|
||||
pub fn cli() -> App {
|
||||
subcommand("locate-project")
|
||||
|
|
|
@ -1,18 +1,8 @@
|
|||
#![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
|
||||
#![allow(clippy::too_many_arguments)] // large project
|
||||
#![allow(clippy::redundant_closure)] // there's a false positive
|
||||
|
||||
use cargo;
|
||||
|
||||
#[cfg(not(feature = "pretty-env-logger"))]
|
||||
extern crate env_logger;
|
||||
#[cfg(feature = "pretty-env-logger")]
|
||||
extern crate pretty_env_logger;
|
||||
#[macro_use]
|
||||
extern crate failure;
|
||||
use git2_curl;
|
||||
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
use std::collections::BTreeSet;
|
||||
use std::env;
|
||||
|
|
|
@ -3,6 +3,8 @@ use std::env;
|
|||
use std::path::{Path, PathBuf};
|
||||
use std::str;
|
||||
|
||||
use log::debug;
|
||||
|
||||
use crate::core::profiles::Profiles;
|
||||
use crate::core::{Dependency, Workspace};
|
||||
use crate::core::{PackageId, PackageSet, Resolve};
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
//! dependencies on other Invocations.
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use super::context::OutputFile;
|
||||
use super::{CompileMode, Context, Kind, Unit};
|
||||
use crate::core::TargetKind;
|
||||
use crate::util::{internal, CargoResult, ProcessBuilder};
|
||||
use semver;
|
||||
use serde_json;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
struct Invocation {
|
||||
|
|
|
@ -6,6 +6,7 @@ use std::path::{Path, PathBuf};
|
|||
use std::sync::Arc;
|
||||
|
||||
use lazycell::LazyCell;
|
||||
use log::info;
|
||||
|
||||
use super::{BuildContext, Context, FileFlavor, Kind, Layout, Unit};
|
||||
use crate::core::{TargetKind, Workspace};
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
use std::cell::RefCell;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use log::trace;
|
||||
|
||||
use super::{BuildContext, CompileMode, Kind, Unit};
|
||||
use crate::core::dependency::Kind as DepKind;
|
||||
use crate::core::package::Downloads;
|
||||
|
|
|
@ -5,9 +5,10 @@ use std::path::{Path, PathBuf};
|
|||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use filetime::FileTime;
|
||||
use serde::de::{self, Deserialize};
|
||||
use log::{debug, info};
|
||||
use serde::de;
|
||||
use serde::ser;
|
||||
use serde_json;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::core::{Edition, Package};
|
||||
use crate::util;
|
||||
|
|
|
@ -7,9 +7,9 @@ use std::process::Output;
|
|||
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||
use std::sync::Arc;
|
||||
|
||||
use crossbeam_utils;
|
||||
use crossbeam_utils::thread::Scope;
|
||||
use jobserver::{Acquired, HelperThread};
|
||||
use log::{debug, info, trace};
|
||||
|
||||
use crate::core::profiles::Profile;
|
||||
use crate::core::{PackageId, Target, TargetKind};
|
||||
|
|
|
@ -6,8 +6,9 @@ use std::path::{self, Path, PathBuf};
|
|||
use std::sync::Arc;
|
||||
|
||||
use failure::Error;
|
||||
use log::debug;
|
||||
use same_file::is_same_file;
|
||||
use serde_json;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::core::manifest::TargetSourcePath;
|
||||
use crate::core::profiles::{Lto, Profile};
|
||||
|
|
|
@ -3,6 +3,8 @@ use std::fs::File;
|
|||
use std::io::{BufWriter, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use log::debug;
|
||||
|
||||
use super::{fingerprint, Context, Unit};
|
||||
use crate::util::paths;
|
||||
use crate::util::{internal, CargoResult};
|
||||
|
|
|
@ -2,9 +2,11 @@ use std::fmt;
|
|||
use std::rc::Rc;
|
||||
use std::str::FromStr;
|
||||
|
||||
use log::trace;
|
||||
use semver::ReqParseError;
|
||||
use semver::VersionReq;
|
||||
use serde::ser;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::{PackageId, SourceId, Summary};
|
||||
|
|
|
@ -51,6 +51,7 @@ use std::fmt;
|
|||
use std::str::FromStr;
|
||||
|
||||
use failure::Error;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::util::errors::CargoResult;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ pub fn leak(s: String) -> &'static str {
|
|||
Box::leak(s.into_boxed_str())
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
lazy_static::lazy_static! {
|
||||
static ref STRING_CACHE: Mutex<HashSet<&'static str>> = Mutex::new(HashSet::new());
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::rc::Rc;
|
|||
|
||||
use semver::Version;
|
||||
use serde::ser;
|
||||
use toml;
|
||||
use serde::Serialize;
|
||||
use url::Url;
|
||||
|
||||
use crate::core::interning::InternedString;
|
||||
|
|
|
@ -8,15 +8,14 @@ use std::path::{Path, PathBuf};
|
|||
use std::time::{Duration, Instant};
|
||||
|
||||
use bytesize::ByteSize;
|
||||
use curl;
|
||||
use curl::easy::{Easy, HttpVersion};
|
||||
use curl::multi::{EasyHandle, Multi};
|
||||
use curl_sys;
|
||||
use failure::ResultExt;
|
||||
use lazycell::LazyCell;
|
||||
use log::{debug, warn};
|
||||
use semver::Version;
|
||||
use serde::ser;
|
||||
use toml;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::source::MaybePackage;
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::core::interning::InternedString;
|
|||
use crate::core::source::SourceId;
|
||||
use crate::util::{CargoResult, ToSemver};
|
||||
|
||||
lazy_static! {
|
||||
lazy_static::lazy_static! {
|
||||
static ref PACKAGE_ID_CACHE: Mutex<HashSet<&'static PackageIdInner>> =
|
||||
Mutex::new(HashSet::new());
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use std::collections::HashSet;
|
||||
use std::{cmp, fmt, hash};
|
||||
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::core::compiler::CompileMode;
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::{Features, PackageId, PackageIdSpec, PackageSet, Shell};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use log::{debug, trace};
|
||||
use semver::VersionReq;
|
||||
use url::Url;
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||
|
||||
use log::trace;
|
||||
|
||||
use super::types::ConflictReason;
|
||||
use crate::core::resolver::Context;
|
||||
use crate::core::{Dependency, PackageId};
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||
use std::rc::Rc;
|
||||
|
||||
use log::debug;
|
||||
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::{Dependency, FeatureValue, PackageId, SourceId, Summary};
|
||||
use crate::util::CargoResult;
|
||||
use crate::util::Graph;
|
||||
use im_rc;
|
||||
|
||||
use super::errors::ActivateResult;
|
||||
use super::types::{ConflictReason, DepInfo, GraphNode, Method, RcList, RegistryQueryer};
|
||||
|
|
|
@ -2,8 +2,10 @@ use std::collections::{BTreeMap, HashMap, HashSet};
|
|||
use std::fmt;
|
||||
use std::str::FromStr;
|
||||
|
||||
use log::debug;
|
||||
use serde::de;
|
||||
use serde::ser;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::core::{Dependency, Package, PackageId, SourceId, Workspace};
|
||||
use crate::util::errors::{CargoError, CargoResult, CargoResultExt};
|
||||
|
|
|
@ -52,7 +52,7 @@ use std::mem;
|
|||
use std::rc::Rc;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use semver;
|
||||
use log::{debug, trace};
|
||||
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::PackageIdSpec;
|
||||
|
|
|
@ -4,6 +4,8 @@ use std::ops::Range;
|
|||
use std::rc::Rc;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use log::debug;
|
||||
|
||||
use crate::core::interning::InternedString;
|
||||
use crate::core::{Dependency, PackageId, PackageIdSpec, Registry, Summary};
|
||||
use crate::util::errors::CargoResult;
|
||||
|
|
|
@ -8,6 +8,7 @@ use std::sync::atomic::Ordering::SeqCst;
|
|||
use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT};
|
||||
use std::sync::Mutex;
|
||||
|
||||
use log::trace;
|
||||
use serde::de;
|
||||
use serde::ser;
|
||||
use url::Url;
|
||||
|
@ -18,7 +19,7 @@ use crate::sources::DirectorySource;
|
|||
use crate::sources::{GitSource, PathSource, RegistrySource, CRATES_IO_INDEX};
|
||||
use crate::util::{CargoResult, Config, ToUrl};
|
||||
|
||||
lazy_static! {
|
||||
lazy_static::lazy_static! {
|
||||
static ref SOURCE_ID_CACHE: Mutex<HashSet<&'static SourceIdInner>> = Mutex::new(HashSet::new());
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ use std::path::{Path, PathBuf};
|
|||
use std::slice;
|
||||
|
||||
use glob::glob;
|
||||
use log::debug;
|
||||
use url::Url;
|
||||
|
||||
use crate::core::profiles::Profiles;
|
||||
|
|
|
@ -1,71 +1,25 @@
|
|||
#![cfg_attr(test, deny(warnings))]
|
||||
// Clippy isn't enforced by CI, and know that @alexcrichton isn't a fan :)
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::boxed_local))] // bug rust-lang-nursery/rust-clippy#1123
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::cyclomatic_complexity))] // large project
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::derive_hash_xor_eq))] // there's an intentional incoherence
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::explicit_into_iter_loop))] // explicit loops are clearer
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::explicit_iter_loop))] // explicit loops are clearer
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::identity_op))] // used for vertical alignment
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::implicit_hasher))] // large project
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::large_enum_variant))] // large project
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::redundant_closure_call))] // closures over try catch blocks
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::too_many_arguments))] // large project
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::type_complexity))] // there's an exceptionally complex type
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::wrong_self_convention))] // perhaps Rc should be special cased in Clippy?
|
||||
#![allow(clippy::boxed_local)] // bug rust-lang-nursery/rust-clippy#1123
|
||||
#![allow(clippy::cyclomatic_complexity)] // large project
|
||||
#![allow(clippy::derive_hash_xor_eq)] // there's an intentional incoherence
|
||||
#![allow(clippy::explicit_into_iter_loop)] // explicit loops are clearer
|
||||
#![allow(clippy::explicit_iter_loop)] // explicit loops are clearer
|
||||
#![allow(clippy::identity_op)] // used for vertical alignment
|
||||
#![allow(clippy::implicit_hasher)] // large project
|
||||
#![allow(clippy::large_enum_variant)] // large project
|
||||
#![allow(clippy::redundant_closure_call)] // closures over try catch blocks
|
||||
#![allow(clippy::too_many_arguments)] // large project
|
||||
#![allow(clippy::type_complexity)] // there's an exceptionally complex type
|
||||
#![allow(clippy::wrong_self_convention)] // perhaps Rc should be special cased in Clippy?
|
||||
|
||||
extern crate atty;
|
||||
extern crate bytesize;
|
||||
extern crate clap;
|
||||
#[cfg(target_os = "macos")]
|
||||
extern crate core_foundation;
|
||||
extern crate crates_io as registry;
|
||||
extern crate crossbeam_utils;
|
||||
extern crate curl;
|
||||
extern crate curl_sys;
|
||||
#[macro_use]
|
||||
extern crate failure;
|
||||
extern crate filetime;
|
||||
extern crate flate2;
|
||||
extern crate fs2;
|
||||
#[cfg(windows)]
|
||||
extern crate fwdansi;
|
||||
extern crate git2;
|
||||
extern crate glob;
|
||||
extern crate hex;
|
||||
extern crate home;
|
||||
extern crate ignore;
|
||||
extern crate jobserver;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
extern crate lazycell;
|
||||
extern crate libc;
|
||||
extern crate libgit2_sys;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate num_cpus;
|
||||
extern crate opener;
|
||||
extern crate rustfix;
|
||||
extern crate same_file;
|
||||
extern crate semver;
|
||||
#[macro_use]
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde_ignored;
|
||||
#[macro_use]
|
||||
extern crate serde_json;
|
||||
extern crate im_rc;
|
||||
extern crate shell_escape;
|
||||
extern crate tar;
|
||||
extern crate tempfile;
|
||||
extern crate termcolor;
|
||||
extern crate toml;
|
||||
extern crate unicode_width;
|
||||
extern crate url;
|
||||
|
||||
use std::fmt;
|
||||
|
||||
use failure::Error;
|
||||
use log::debug;
|
||||
use serde::ser;
|
||||
|
||||
use crate::core::shell::Verbosity::Verbose;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use std::collections::{BTreeMap, HashSet};
|
||||
|
||||
use log::debug;
|
||||
use termcolor::Color::{self, Cyan, Green, Red};
|
||||
|
||||
use crate::core::registry::PackageRegistry;
|
||||
|
|
|
@ -7,8 +7,8 @@ use std::sync::Arc;
|
|||
use std::{env, fs};
|
||||
|
||||
use semver::{Version, VersionReq};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tempfile::Builder as TempFileBuilder;
|
||||
use toml;
|
||||
|
||||
use crate::core::compiler::{DefaultExecutor, Executor};
|
||||
use crate::core::package::PackageSet;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use serde::ser;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::core::resolver::Resolve;
|
||||
use crate::core::{Package, PackageId, Workspace};
|
||||
|
|
|
@ -6,8 +6,8 @@ use std::sync::Arc;
|
|||
|
||||
use flate2::read::GzDecoder;
|
||||
use flate2::{Compression, GzBuilder};
|
||||
use git2;
|
||||
use serde_json;
|
||||
use log::debug;
|
||||
use serde_json::{self, json};
|
||||
use tar::{Archive, Builder, EntryType, Header};
|
||||
|
||||
use crate::core::compiler::{BuildConfig, CompileMode, DefaultExecutor, Executor};
|
||||
|
|
|
@ -3,6 +3,8 @@ use std::fs;
|
|||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use log::{info, trace};
|
||||
|
||||
use crate::core::{EitherManifest, Package, PackageId, SourceId};
|
||||
use crate::util::errors::{CargoError, CargoResult};
|
||||
use crate::util::important_paths::find_project_manifest_exact;
|
||||
|
|
|
@ -82,9 +82,7 @@ pub fn run(
|
|||
assert_eq!(compile.binaries.len(), 1);
|
||||
let exe = &compile.binaries[0];
|
||||
let exe = match util::without_prefix(exe, config.cwd()) {
|
||||
Some(path) if path.file_name() == Some(path.as_os_str()) => {
|
||||
Path::new(".").join(path)
|
||||
}
|
||||
Some(path) if path.file_name() == Some(path.as_os_str()) => Path::new(".").join(path),
|
||||
Some(path) => path.to_path_buf(),
|
||||
None => exe.to_path_buf(),
|
||||
};
|
||||
|
|
|
@ -7,10 +7,9 @@ use std::process::{self, Command, ExitStatus};
|
|||
use std::str;
|
||||
|
||||
use failure::{Error, ResultExt};
|
||||
use git2;
|
||||
use log::{debug, trace, warn};
|
||||
use rustfix::diagnostics::Diagnostic;
|
||||
use rustfix::{self, CodeFix};
|
||||
use serde_json;
|
||||
|
||||
use crate::core::Workspace;
|
||||
use crate::ops::{self, CompileOptions};
|
||||
|
@ -402,7 +401,9 @@ fn rustfix_and_fix(
|
|||
// Make sure we've got a file associated with this suggestion and all
|
||||
// snippets point to the same file. Right now it's not clear what
|
||||
// we would do with multiple files.
|
||||
let file_names = suggestion.solutions.iter()
|
||||
let file_names = suggestion
|
||||
.solutions
|
||||
.iter()
|
||||
.flat_map(|s| s.replacements.iter())
|
||||
.map(|r| &r.snippet.file_name);
|
||||
|
||||
|
|
|
@ -5,11 +5,9 @@ use std::str;
|
|||
use std::time::Duration;
|
||||
use std::{cmp, env};
|
||||
|
||||
use crate::registry::{NewCrate, NewCrateDependency, Registry};
|
||||
use crates_io::{NewCrate, NewCrateDependency, Registry};
|
||||
use curl::easy::{Easy, InfoType, SslOpt};
|
||||
use git2;
|
||||
use log::Level;
|
||||
|
||||
use log::{log, Level};
|
||||
use url::percent_encoding::{percent_encode, QUERY_ENCODE_SET};
|
||||
|
||||
use crate::core::dependency::Kind;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
use std::collections::HashSet;
|
||||
|
||||
use log::{debug, trace};
|
||||
|
||||
use crate::core::registry::PackageRegistry;
|
||||
use crate::core::resolver::{self, Method, Resolve};
|
||||
use crate::core::{PackageId, PackageIdSpec, PackageSet, Source, SourceId, Workspace};
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
use std::collections::HashMap;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use log::debug;
|
||||
use url::Url;
|
||||
|
||||
use crate::core::{GitReference, Source, SourceId};
|
||||
|
|
|
@ -4,9 +4,7 @@ use std::fs::File;
|
|||
use std::io::Read;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use hex;
|
||||
|
||||
use serde_json;
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::core::source::MaybePackage;
|
||||
use crate::core::{Dependency, Package, PackageId, Source, SourceId, Summary};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use std::fmt::{self, Debug, Formatter};
|
||||
|
||||
use log::trace;
|
||||
use url::Url;
|
||||
|
||||
use crate::core::source::{MaybePackage, Source, SourceId};
|
||||
|
|
|
@ -7,7 +7,9 @@ use std::process::Command;
|
|||
|
||||
use curl::easy::{Easy, List};
|
||||
use git2::{self, ObjectType};
|
||||
use log::{debug, info};
|
||||
use serde::ser;
|
||||
use serde::Serialize;
|
||||
use url::Url;
|
||||
|
||||
use crate::core::GitReference;
|
||||
|
|
|
@ -3,10 +3,10 @@ use std::fs;
|
|||
use std::path::{Path, PathBuf};
|
||||
|
||||
use filetime::FileTime;
|
||||
use git2;
|
||||
use glob::Pattern;
|
||||
use ignore::gitignore::GitignoreBuilder;
|
||||
use ignore::Match;
|
||||
use log::{trace, warn};
|
||||
|
||||
use crate::core::source::MaybePackage;
|
||||
use crate::core::{Dependency, Package, PackageId, Source, SourceId, Summary};
|
||||
|
|
|
@ -2,8 +2,8 @@ use std::collections::HashMap;
|
|||
use std::path::Path;
|
||||
use std::str;
|
||||
|
||||
use log::{info, trace};
|
||||
use semver::Version;
|
||||
use serde_json;
|
||||
|
||||
use crate::core::dependency::Dependency;
|
||||
use crate::core::{PackageId, SourceId, Summary};
|
||||
|
|
|
@ -164,9 +164,9 @@ use std::fs::File;
|
|||
use std::path::{Path, PathBuf};
|
||||
|
||||
use flate2::read::GzDecoder;
|
||||
use log::debug;
|
||||
use semver::Version;
|
||||
#[cfg(test)]
|
||||
use serde_json;
|
||||
use serde::Deserialize;
|
||||
use tar::Archive;
|
||||
|
||||
use crate::core::dependency::{Dependency, Kind};
|
||||
|
|
|
@ -6,10 +6,8 @@ use std::mem;
|
|||
use std::path::Path;
|
||||
use std::str;
|
||||
|
||||
use git2;
|
||||
use hex;
|
||||
use lazycell::LazyCell;
|
||||
use serde_json;
|
||||
use log::{debug, trace};
|
||||
|
||||
use crate::core::{PackageId, SourceId};
|
||||
use crate::sources::git;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use std;
|
||||
use std::cell::{RefCell, RefMut};
|
||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
||||
use std::collections::hash_map::HashMap;
|
||||
|
@ -16,11 +15,9 @@ use std::time::Instant;
|
|||
use std::vec;
|
||||
|
||||
use curl::easy::Easy;
|
||||
use failure;
|
||||
use jobserver;
|
||||
use lazycell::LazyCell;
|
||||
use serde::Deserialize;
|
||||
use serde::{de, de::IntoDeserializer};
|
||||
use toml;
|
||||
|
||||
use crate::core::profiles::ConfigProfiles;
|
||||
use crate::core::shell::Verbosity;
|
||||
|
@ -1140,7 +1137,7 @@ impl<'de, 'config> de::Deserializer<'de> for Deserializer<'config> {
|
|||
}
|
||||
|
||||
// These aren't really supported, yet.
|
||||
forward_to_deserialize_any! {
|
||||
serde::forward_to_deserialize_any! {
|
||||
f32 f64 char str bytes
|
||||
byte_buf unit unit_struct
|
||||
enum identifier ignored_any
|
||||
|
|
|
@ -10,7 +10,8 @@ use std::sync::Arc;
|
|||
use std::thread::{self, JoinHandle};
|
||||
|
||||
use failure::{Error, ResultExt};
|
||||
use serde_json;
|
||||
use log::warn;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::util::errors::CargoResult;
|
||||
use crate::util::{Config, ProcessBuilder};
|
||||
|
|
|
@ -5,9 +5,11 @@ use std::path::PathBuf;
|
|||
use std::process::{ExitStatus, Output};
|
||||
use std::str;
|
||||
|
||||
use crate::core::{TargetKind, Workspace};
|
||||
use clap;
|
||||
use failure::{Context, Error, Fail};
|
||||
use log::trace;
|
||||
|
||||
use crate::core::{TargetKind, Workspace};
|
||||
|
||||
pub use failure::Error as CargoError;
|
||||
pub type CargoResult<T> = Result<T, Error>;
|
||||
|
|
|
@ -42,18 +42,18 @@ mod imp {
|
|||
|
||||
#[cfg(windows)]
|
||||
mod imp {
|
||||
extern crate winapi;
|
||||
|
||||
use std::io;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
use self::winapi::shared::minwindef::*;
|
||||
use self::winapi::um::handleapi::*;
|
||||
use self::winapi::um::jobapi2::*;
|
||||
use self::winapi::um::processthreadsapi::*;
|
||||
use self::winapi::um::winnt::HANDLE;
|
||||
use self::winapi::um::winnt::*;
|
||||
use log::info;
|
||||
|
||||
use winapi::shared::minwindef::*;
|
||||
use winapi::um::handleapi::*;
|
||||
use winapi::um::jobapi2::*;
|
||||
use winapi::um::processthreadsapi::*;
|
||||
use winapi::um::winnt::HANDLE;
|
||||
use winapi::um::winnt::*;
|
||||
|
||||
pub struct Setup {
|
||||
job: Handle,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
use serde::ser;
|
||||
use serde_json::{self, value::RawValue};
|
||||
use serde::Serialize;
|
||||
use serde_json::{self, json, value::RawValue};
|
||||
|
||||
use crate::core::{PackageId, Target};
|
||||
|
||||
|
|
|
@ -77,18 +77,15 @@ mod imp {
|
|||
|
||||
#[cfg(windows)]
|
||||
mod imp {
|
||||
extern crate miow;
|
||||
extern crate winapi;
|
||||
|
||||
use std::io;
|
||||
use std::os::windows::prelude::*;
|
||||
use std::process::{ChildStderr, ChildStdout};
|
||||
use std::slice;
|
||||
|
||||
use self::miow::iocp::{CompletionPort, CompletionStatus};
|
||||
use self::miow::pipe::NamedPipe;
|
||||
use self::miow::Overlapped;
|
||||
use self::winapi::shared::winerror::ERROR_BROKEN_PIPE;
|
||||
use miow::iocp::{CompletionPort, CompletionStatus};
|
||||
use miow::pipe::NamedPipe;
|
||||
use miow::Overlapped;
|
||||
use winapi::shared::winerror::ERROR_BROKEN_PIPE;
|
||||
|
||||
struct Pipe<'a> {
|
||||
dst: &'a mut Vec<u8>,
|
||||
|
|
|
@ -7,7 +7,8 @@ use std::path::{Path, PathBuf};
|
|||
use std::process::Stdio;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use serde_json;
|
||||
use log::{debug, info, warn};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::util::paths;
|
||||
use crate::util::{self, internal, profile, CargoResult, ProcessBuilder};
|
||||
|
|
|
@ -5,11 +5,11 @@ use std::path::{Path, PathBuf};
|
|||
use std::rc::Rc;
|
||||
use std::str;
|
||||
|
||||
use log::{debug, trace};
|
||||
use semver::{self, VersionReq};
|
||||
use serde::de::{self, Deserialize};
|
||||
use serde::de;
|
||||
use serde::ser;
|
||||
use serde_ignored;
|
||||
use toml;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use url::Url;
|
||||
|
||||
use crate::core::dependency::{Kind, Platform};
|
||||
|
@ -152,7 +152,7 @@ type TomlExampleTarget = TomlTarget;
|
|||
type TomlTestTarget = TomlTarget;
|
||||
type TomlBenchTarget = TomlTarget;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[derive(Serialize, Debug)]
|
||||
#[serde(untagged)]
|
||||
pub enum TomlDependency {
|
||||
Simple(String),
|
||||
|
|
Loading…
Reference in a new issue