mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Format code
Signed-off-by: Mateusz Mikuła <mati865@gmail.com>
This commit is contained in:
parent
cfb9b982c5
commit
23bfa396a0
7 changed files with 31 additions and 18 deletions
|
@ -193,7 +193,5 @@ pub fn main() {
|
|||
}
|
||||
|
||||
let mut ccc = ClippyCompilerCalls::new(clippy_enabled);
|
||||
rustc_driver::run(move || {
|
||||
rustc_driver::run_compiler(&args, &mut ccc, None, None)
|
||||
});
|
||||
rustc_driver::run(move || rustc_driver::run_compiler(&args, &mut ccc, None, None));
|
||||
}
|
||||
|
|
|
@ -67,7 +67,10 @@ pub fn main() {
|
|||
let mut metadata = if let Ok(metadata) = cargo_metadata::metadata(manifest_path_arg.as_ref().map(AsRef::as_ref)) {
|
||||
metadata
|
||||
} else {
|
||||
println!("{:?}", cargo_metadata::metadata(manifest_path_arg.as_ref().map(AsRef::as_ref)));
|
||||
println!(
|
||||
"{:?}",
|
||||
cargo_metadata::metadata(manifest_path_arg.as_ref().map(AsRef::as_ref))
|
||||
);
|
||||
let _ = io::stderr().write_fmt(format_args!("error: Could not obtain cargo metadata.\n"));
|
||||
process::exit(101);
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
extern crate compiletest_rs as compiletest;
|
||||
extern crate test;
|
||||
|
||||
use std::path::{PathBuf, Path};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::env::{set_var, var};
|
||||
|
||||
fn clippy_driver_path() -> PathBuf {
|
||||
|
@ -43,7 +43,10 @@ fn config(dir: &'static str, mode: &'static str) -> compiletest::Config {
|
|||
config.run_lib_path = rustc_lib_path();
|
||||
config.compile_lib_path = rustc_lib_path();
|
||||
}
|
||||
config.target_rustcflags = Some(format!("-L {0} -L {0}/deps -Dwarnings", host_libs().display()));
|
||||
config.target_rustcflags = Some(format!(
|
||||
"-L {0} -L {0}/deps -Dwarnings",
|
||||
host_libs().display()
|
||||
));
|
||||
|
||||
config.mode = cfg_mode;
|
||||
config.build_base = if rustc_test_suite().is_some() {
|
||||
|
|
|
@ -11,9 +11,12 @@ fn dogfood() {
|
|||
std::env::set_current_dir(root_dir.join(d)).unwrap();
|
||||
let output = std::process::Command::new("cargo")
|
||||
.arg("run")
|
||||
.arg("--bin").arg("cargo-clippy")
|
||||
.arg("--manifest-path").arg(root_dir.join("Cargo.toml"))
|
||||
.output().unwrap();
|
||||
.arg("--bin")
|
||||
.arg("cargo-clippy")
|
||||
.arg("--manifest-path")
|
||||
.arg(root_dir.join("Cargo.toml"))
|
||||
.output()
|
||||
.unwrap();
|
||||
println!("status: {}", output.status);
|
||||
println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
|
||||
println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
|
||||
|
|
|
@ -9,16 +9,17 @@ fn test_overlapping() {
|
|||
use clippy_lints::matches::overlapping;
|
||||
use syntax::codemap::DUMMY_SP;
|
||||
|
||||
let sp = |s, e| {
|
||||
clippy_lints::matches::SpannedRange {
|
||||
span: DUMMY_SP,
|
||||
node: (s, e),
|
||||
}
|
||||
let sp = |s, e| clippy_lints::matches::SpannedRange {
|
||||
span: DUMMY_SP,
|
||||
node: (s, e),
|
||||
};
|
||||
|
||||
assert_eq!(None, overlapping::<u8>(&[]));
|
||||
assert_eq!(None, overlapping(&[sp(1, Bound::Included(4))]));
|
||||
assert_eq!(None, overlapping(&[sp(1, Bound::Included(4)), sp(5, Bound::Included(6))]));
|
||||
assert_eq!(
|
||||
None,
|
||||
overlapping(&[sp(1, Bound::Included(4)), sp(5, Bound::Included(6))])
|
||||
);
|
||||
assert_eq!(
|
||||
None,
|
||||
overlapping(&[
|
||||
|
|
|
@ -69,7 +69,6 @@ fn test_erode_from_front_no_brace() {
|
|||
assert_eq!(expected, got);
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
||||
fn test_erode_block() {
|
||||
|
|
|
@ -7,10 +7,16 @@ fn check_that_clippy_lints_has_the_same_version_as_clippy() {
|
|||
let clippy_meta = cargo_metadata::metadata(None).expect("could not obtain cargo metadata");
|
||||
std::env::set_current_dir(std::env::current_dir().unwrap().join("clippy_lints")).unwrap();
|
||||
let clippy_lints_meta = cargo_metadata::metadata(None).expect("could not obtain cargo metadata");
|
||||
assert_eq!(clippy_lints_meta.packages[0].version, clippy_meta.packages[0].version);
|
||||
assert_eq!(
|
||||
clippy_lints_meta.packages[0].version,
|
||||
clippy_meta.packages[0].version
|
||||
);
|
||||
for package in &clippy_meta.packages[0].dependencies {
|
||||
if package.name == "clippy_lints" {
|
||||
assert_eq!(VersionReq::parse(&clippy_lints_meta.packages[0].version).unwrap(), package.req);
|
||||
assert_eq!(
|
||||
VersionReq::parse(&clippy_lints_meta.packages[0].version).unwrap(),
|
||||
package.req
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue