Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustup to latest nightly #2703

Merged
merged 1 commit into from
Apr 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions clippy_lints/src/copies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc::ty::Ty;
use rustc::hir::*;
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use syntax::symbol::InternedString;
use syntax::symbol::LocalInternedString;
use syntax::util::small_vector::SmallVector;
use utils::{SpanlessEq, SpanlessHash};
use utils::{get_parent_expr, in_macro, snippet, span_lint_and_then, span_note_and_lint};
Expand Down Expand Up @@ -262,8 +262,8 @@ fn if_sequence(mut expr: &Expr) -> (SmallVector<&Expr>, SmallVector<&Block>) {
}

/// Return the list of bindings in a pattern.
fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap<InternedString, Ty<'tcx>> {
fn bindings_impl<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat, map: &mut HashMap<InternedString, Ty<'tcx>>) {
fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap<LocalInternedString, Ty<'tcx>> {
fn bindings_impl<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat, map: &mut HashMap<LocalInternedString, Ty<'tcx>>) {
match pat.node {
PatKind::Box(ref pat) | PatKind::Ref(ref pat, _) => bindings_impl(cx, pat, map),
PatKind::TupleStruct(_, ref pats, _) => for pat in pats {
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/enum_variants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use rustc::lint::*;
use syntax::ast::*;
use syntax::codemap::Span;
use syntax::symbol::InternedString;
use syntax::symbol::LocalInternedString;
use utils::{span_help_and_lint, span_lint};
use utils::{camel_case_from, camel_case_until, in_macro};

Expand Down Expand Up @@ -99,7 +99,7 @@ declare_clippy_lint! {
}

pub struct EnumVariantNames {
modules: Vec<(InternedString, String)>,
modules: Vec<(LocalInternedString, String)>,
threshold: u64,
}

Expand All @@ -118,7 +118,7 @@ impl LintPass for EnumVariantNames {
}
}

fn var2str(var: &Variant) -> InternedString {
fn var2str(var: &Variant) -> LocalInternedString {
var.node.ident.name.as_str()
}

Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/non_expressive_names.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc::lint::*;
use syntax::codemap::Span;
use syntax::symbol::InternedString;
use syntax::symbol::LocalInternedString;
use syntax::ast::*;
use syntax::attr;
use syntax::visit::{walk_block, walk_expr, walk_pat, Visitor};
Expand Down Expand Up @@ -73,7 +73,7 @@ impl LintPass for NonExpressiveNames {
}

struct ExistingName {
interned: InternedString,
interned: LocalInternedString,
span: Span,
len: usize,
whitelist: &'static [&'static str],
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/unsafe_removed_from_name.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc::lint::*;
use syntax::ast::*;
use syntax::codemap::Span;
use syntax::symbol::InternedString;
use syntax::symbol::LocalInternedString;
use utils::span_lint;

/// **What it does:** Checks for imports that remove "unsafe" from an item's
Expand Down Expand Up @@ -75,6 +75,6 @@ fn unsafe_to_safe_check(old_name: Ident, new_name: Ident, cx: &EarlyContext, spa
}
}

fn contains_unsafe(name: &InternedString) -> bool {
fn contains_unsafe(name: &LocalInternedString) -> bool {
name.contains("Unsafe") || name.contains("unsafe")
}
4 changes: 2 additions & 2 deletions clippy_lints/src/unused_label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustc::hir::intravisit::{walk_expr, walk_fn, FnKind, NestedVisitorMap, Visit
use std::collections::HashMap;
use syntax::ast;
use syntax::codemap::Span;
use syntax::symbol::InternedString;
use syntax::symbol::LocalInternedString;
use utils::{in_macro, span_lint};

/// **What it does:** Checks for unused labels.
Expand All @@ -30,7 +30,7 @@ declare_clippy_lint! {
pub struct UnusedLabel;

struct UnusedLabelVisitor<'a, 'tcx: 'a> {
labels: HashMap<InternedString, Span>,
labels: HashMap<LocalInternedString, Span>,
cx: &'a LateContext<'a, 'tcx>,
}

Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/utils/internal_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use rustc::lint::*;
use rustc::hir::*;
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use utils::{match_qpath, paths, span_lint};
use syntax::symbol::InternedString;
use syntax::symbol::LocalInternedString;
use syntax::ast::{Crate as AstCrate, ItemKind, Name, NodeId};
use syntax::codemap::Span;
use std::collections::{HashMap, HashSet};
Expand Down Expand Up @@ -76,7 +76,7 @@ impl EarlyLintPass for Clippy {
.find(|item| item.ident.name == "paths")
{
if let ItemKind::Mod(ref paths_mod) = paths.node {
let mut last_name: Option<InternedString> = None;
let mut last_name: Option<LocalInternedString> = None;
for item in &paths_mod.items {
let name = item.ident.name.as_str();
if let Some(ref last_name) = last_name {
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ pub fn match_def_path(tcx: TyCtxt, def_id: DefId, path: &[&str]) -> bool {
use syntax::symbol;

struct AbsolutePathBuffer {
names: Vec<symbol::InternedString>,
names: Vec<symbol::LocalInternedString>,
}

impl ty::item_path::ItemPathBuffer for AbsolutePathBuffer {
Expand Down Expand Up @@ -302,7 +302,7 @@ pub fn implements_trait<'a, 'tcx>(
cx.tcx
.predicate_for_trait_def(cx.param_env, traits::ObligationCause::dummy(), trait_id, 0, ty, ty_params);
cx.tcx.infer_ctxt().enter(|infcx| {
traits::SelectionContext::new(&infcx).evaluate_obligation_conservatively(&obligation)
traits::SelectionContext::new(&infcx).infcx().predicate_must_hold(&obligation)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, didn't see this PR earlier but this could just be infcx.predicate_must_hold(...) --- i.e., no need to create a SelectionContext. No functional difference though, and I suppose not much perf difference in practice either, so not a big deal.

})
}

Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustc::lint::*;
use std::ops::Deref;
use syntax::ast::LitKind;
use syntax::ptr;
use syntax::symbol::InternedString;
use syntax::symbol::LocalInternedString;
use syntax_pos::Span;
use utils::{is_expn_of, match_def_path, match_path, resolve_node, span_lint, span_lint_and_sugg};
use utils::{opt_def_id, paths, last_path_segment};
Expand Down Expand Up @@ -389,7 +389,7 @@ where
}

/// Check for fmtstr = "... \n"
fn has_newline_end(args: &HirVec<Expr>, fmtstr: InternedString, fmtlen: usize) -> bool {
fn has_newline_end(args: &HirVec<Expr>, fmtstr: LocalInternedString, fmtlen: usize) -> bool {
if_chain! {
// check the final format string part
if let Some('\n') = fmtstr.chars().last();
Expand All @@ -407,7 +407,7 @@ fn has_newline_end(args: &HirVec<Expr>, fmtstr: InternedString, fmtlen: usize) -
}

/// Check for writeln!(v, "") / println!("")
fn has_empty_arg<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, span: Span, fmtstr: InternedString, fmtlen: usize) -> Option<Span> {
fn has_empty_arg<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, span: Span, fmtstr: LocalInternedString, fmtlen: usize) -> Option<Span> {
if_chain! {
// check that the string is empty
if fmtlen == 1;
Expand All @@ -427,7 +427,7 @@ fn has_empty_arg<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, span: Span, fmtstr: Inter
}

/// Returns the slice of format string parts in an `Arguments::new_v1` call.
fn get_argument_fmtstr_parts(expr: &Expr) -> Option<(InternedString, usize)> {
fn get_argument_fmtstr_parts(expr: &Expr) -> Option<(LocalInternedString, usize)> {
if_chain! {
if let ExprAddrOf(_, ref expr) = expr.node; // &["…", "…", …]
if let ExprArray(ref exprs) = expr.node;
Expand Down