Skip to content
/ rustc Public
forked from rust-lang/rust

Commit

Permalink
Auto merge of #5665 - flip1995:rustup, r=matthiaskrgr
Browse files Browse the repository at this point in the history
Rustup

r? @matthiaskrgr

I finally got to doing the rustup. Sorry for taking so long, I was busy the last few days.

@ebroto FYI: I had to add b6c58f0 to make Clippy pass the rustc test suite.

changelog: none
  • Loading branch information
bors committed May 31, 2020
2 parents 7ea7cd1 + 37381d3 commit 5713574
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
11 changes: 2 additions & 9 deletions clippy_lints/src/needless_pass_by_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {

let fn_def_id = cx.tcx.hir().local_def_id(hir_id);

let preds = traits::elaborate_predicates(cx.tcx, cx.param_env.caller_bounds.iter().copied())
let preds = traits::elaborate_predicates(cx.tcx, cx.param_env.caller_bounds.iter())
.filter(|p| !p.is_global())
.filter_map(|obligation| {
if let ty::PredicateKind::Trait(poly_trait_ref, _) = obligation.predicate.kind() {
Expand Down Expand Up @@ -173,14 +173,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
!preds.is_empty() && {
let ty_empty_region = cx.tcx.mk_imm_ref(cx.tcx.lifetimes.re_root_empty, ty);
preds.iter().all(|t| {
let ty_params = &t
.skip_binder()
.trait_ref
.substs
.iter()
.skip(1)
.cloned()
.collect::<Vec<_>>();
let ty_params = &t.skip_binder().trait_ref.substs.iter().skip(1).collect::<Vec<_>>();
implements_trait(cx, ty_empty_region, t.def_id(), ty_params)
})
},
Expand Down
13 changes: 6 additions & 7 deletions clippy_lints/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,12 @@ impl EarlyLintPass for Write {
if let (Some(fmt_str), expr) = self.check_tts(cx, &mac.args.inner_tokens(), true) {
if fmt_str.symbol == Symbol::intern("") {
let mut applicability = Applicability::MachineApplicable;
let suggestion = expr.map_or_else(
move || {
applicability = Applicability::HasPlaceholders;
Cow::Borrowed("v")
},
move |expr| snippet_with_applicability(cx, expr.span, "v", &mut applicability),
);
let suggestion = if let Some(e) = expr {
snippet_with_applicability(cx, e.span, "v", &mut applicability)
} else {
applicability = Applicability::HasPlaceholders;
Cow::Borrowed("v")
};

span_lint_and_sugg(
cx,
Expand Down
1 change: 0 additions & 1 deletion src/driver.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
#![feature(rustc_private)]
#![feature(str_strip)]

// FIXME: switch to something more ergonomic here, once available.
// (Currently there is no way to opt into sysroot crates without `extern crate`.)
Expand Down
4 changes: 4 additions & 0 deletions tests/compile-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ fn run_ui_cargo(config: &mut compiletest::Config) {
Ok(result)
}

if cargo::is_rustc_test_suite() {
return;
}

config.mode = TestMode::Ui;
config.src_base = Path::new("tests").join("ui-cargo").canonicalize().unwrap();

Expand Down

0 comments on commit 5713574

Please sign in to comment.