Reformat after idiom lints

This commit is contained in:
Alex Crichton 2018-12-10 17:58:06 -08:00
parent 92bf2c3604
commit 76ce4dfebd
9 changed files with 54 additions and 35 deletions

View file

@ -37,18 +37,18 @@ glob = "0.2.11"
hex = "0.3"
home = "0.3"
ignore = "0.4"
lazy_static = "1.0.0"
lazy_static = "1.2.0"
jobserver = "0.1.11"
lazycell = "1.2.0"
libc = "0.2"
log = "0.4"
log = "0.4.6"
libgit2-sys = "0.7.9"
num_cpus = "1.0"
opener = "0.3.0"
rustfix = "0.4.2"
same-file = "1"
semver = { version = "0.9.0", features = ["serde"] }
serde = { version = "1.0", features = ['derive'] }
serde = { version = "1.0.82", features = ['derive'] }
serde_ignored = "0.0.4"
serde_json = { version = "1.0.30", features = ["raw_value"] }
shell-escape = "0.1.4"

View file

@ -471,20 +471,21 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
fn check_collistions(&self) -> CargoResult<()> {
let mut output_collisions = HashMap::new();
let describe_collision = |unit: &Unit<'_>, other_unit: &Unit<'_>, path: &PathBuf| -> String {
format!(
"The {} target `{}` in package `{}` has the same output \
filename as the {} target `{}` in package `{}`.\n\
Colliding filename is: {}\n",
unit.target.kind().description(),
unit.target.name(),
unit.pkg.package_id(),
other_unit.target.kind().description(),
other_unit.target.name(),
other_unit.pkg.package_id(),
path.display()
)
};
let describe_collision =
|unit: &Unit<'_>, other_unit: &Unit<'_>, path: &PathBuf| -> String {
format!(
"The {} target `{}` in package `{}` has the same output \
filename as the {} target `{}` in package `{}`.\n\
Colliding filename is: {}\n",
unit.target.kind().description(),
unit.target.name(),
unit.pkg.package_id(),
other_unit.target.kind().description(),
other_unit.target.name(),
other_unit.pkg.package_id(),
path.display()
)
};
let suggestion = "Consider changing their names to be unique or compiling them separately.\n\
This may become a hard error in the future, see https://github.com/rust-lang/cargo/issues/6313";
let report_collision = |unit: &Unit<'_>,

View file

@ -347,7 +347,10 @@ fn maybe_lib<'a>(
/// script itself doesn't have any dependencies, so even in that case a unit
/// of work is still returned. `None` is only returned if the package has no
/// build script.
fn dep_build_script<'a>(unit: &Unit<'a>, bcx: &BuildContext<'_, '_>) -> Option<(Unit<'a>, UnitFor)> {
fn dep_build_script<'a>(
unit: &Unit<'a>,
bcx: &BuildContext<'_, '_>,
) -> Option<(Unit<'a>, UnitFor)> {
unit.pkg
.targets()
.iter()

View file

@ -421,7 +421,12 @@ impl<'a> JobQueue<'a> {
Ok(())
}
fn emit_warnings(&self, msg: Option<&str>, key: &Key<'a>, cx: &mut Context<'_, '_>) -> CargoResult<()> {
fn emit_warnings(
&self,
msg: Option<&str>,
key: &Key<'a>,
cx: &mut Context<'_, '_>,
) -> CargoResult<()> {
let output = cx.build_state.outputs.lock().unwrap();
let bcx = &mut cx.bcx;
if let Some(output) = output.get(&(key.pkg, key.kind)) {

View file

@ -132,7 +132,11 @@ impl Profiles {
}
/// Used to check for overrides for non-existing packages.
pub fn validate_packages(&self, shell: &mut Shell, packages: &PackageSet<'_>) -> CargoResult<()> {
pub fn validate_packages(
&self,
shell: &mut Shell,
packages: &PackageSet<'_>,
) -> CargoResult<()> {
self.dev.validate_packages(shell, packages)?;
self.release.validate_packages(shell, packages)?;
self.test.validate_packages(shell, packages)?;

View file

@ -15,7 +15,12 @@ use crate::util::{profile, Config};
/// See also `core::Source`.
pub trait Registry {
/// Attempt to find the packages that match a dependency request.
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary), fuzzy: bool) -> CargoResult<()>;
fn query(
&mut self,
dep: &Dependency,
f: &mut dyn FnMut(Summary),
fuzzy: bool,
) -> CargoResult<()>;
fn query_vec(&mut self, dep: &Dependency, fuzzy: bool) -> CargoResult<Vec<Summary>> {
let mut ret = Vec::new();
@ -404,7 +409,12 @@ https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#overridin
}
impl<'cfg> Registry for PackageRegistry<'cfg> {
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary), fuzzy: bool) -> CargoResult<()> {
fn query(
&mut self,
dep: &Dependency,
f: &mut dyn FnMut(Summary),
fuzzy: bool,
) -> CargoResult<()> {
assert!(self.patches_locked);
let (override_summary, n, to_warn) = {
// Look for an override and get ready to query the real source.

View file

@ -376,14 +376,12 @@ mod imp {
#[cfg(windows)]
mod imp {
extern crate winapi;
use self::winapi::um::fileapi::*;
use self::winapi::um::handleapi::*;
use self::winapi::um::processenv::*;
use self::winapi::um::winbase::*;
use self::winapi::um::wincon::*;
use self::winapi::um::winnt::*;
use winapi::um::fileapi::*;
use winapi::um::handleapi::*;
use winapi::um::processenv::*;
use winapi::um::winbase::*;
use winapi::um::wincon::*;
use winapi::um::winnt::*;
use std::{cmp, mem, ptr};
pub(super) use super::default_err_erase_line as err_erase_line;

View file

@ -340,10 +340,8 @@ mod imp {
#[cfg(windows)]
mod imp {
extern crate winapi;
use self::winapi::shared::minwindef::{BOOL, DWORD, FALSE, TRUE};
use self::winapi::um::consoleapi::SetConsoleCtrlHandler;
use winapi::shared::minwindef::{BOOL, DWORD, FALSE, TRUE};
use winapi::um::consoleapi::SetConsoleCtrlHandler;
use crate::util::{process_error, ProcessBuilder};
use crate::CargoResult;

View file

@ -97,7 +97,7 @@ mod imp {
pub fn read2(
out_pipe: ChildStdout,
err_pipe: ChildStderr,
data: &mut FnMut(bool, &mut Vec<u8>, bool),
data: &mut dyn FnMut(bool, &mut Vec<u8>, bool),
) -> io::Result<()> {
let mut out = Vec::new();
let mut err = Vec::new();