]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #4150 - rust-lang:rustup, r=oli-obk
authorbors <bors@rust-lang.org>
Mon, 27 May 2019 19:59:33 +0000 (19:59 +0000)
committerbors <bors@rust-lang.org>
Mon, 27 May 2019 19:59:33 +0000 (19:59 +0000)
Rustup to rustc 1.36.0-nightly (fa40a111f 2019-05-27)

changelog: none

clippy_lints/src/consts.rs
clippy_lints/src/types.rs
clippy_lints/src/utils/mod.rs

index 8f18102101d34283003ba4745ab643daf7d4f3b5..fff029155891b923f35ca3f4e6bbfb5031d3db78 100644 (file)
@@ -14,7 +14,7 @@
 use std::convert::TryInto;
 use std::hash::{Hash, Hasher};
 use syntax::ast::{FloatTy, LitKind};
-use syntax_pos::symbol::{LocalInternedString, Symbol};
+use syntax_pos::symbol::Symbol;
 
 /// A `LitKind`-like enum to fold constant `Expr`s into.
 #[derive(Debug, Clone)]
@@ -250,14 +250,18 @@ pub fn expr(&mut self, e: &Expr) -> Option<Constant> {
                     if let ExprKind::Path(qpath) = &callee.node;
                     let res = self.tables.qpath_res(qpath, callee.hir_id);
                     if let Some(def_id) = res.opt_def_id();
-                    let get_def_path = self.lcx.get_def_path(def_id);
+                    let get_def_path = self.lcx.get_def_path(def_id);
                     let def_path = get_def_path
                         .iter()
-                        .map(LocalInternedString::get)
+                        .copied()
+                        .map(Symbol::as_str)
                         .collect::<Vec<_>>();
-                    if let &["core", "num", impl_ty, "max_value"] = &def_path[..];
+                    if def_path[0] == "core";
+                    if def_path[1] == "num";
+                    if def_path[3] == "max_value";
+                    if def_path.len() == 4;
                     then {
-                       let value = match impl_ty {
+                       let value = match &*def_path[2] {
                            "<impl i8>" => i8::max_value() as u128,
                            "<impl i16>" => i16::max_value() as u128,
                            "<impl i32>" => i32::max_value() as u128,
index 7bce42369dc8eb30f1bd6c01128e30a2336599a1..7b41bea4ff4bea2e5c190a3a435df7b4e6c44fdc 100644 (file)
@@ -18,6 +18,7 @@
 use syntax::ast::{FloatTy, IntTy, UintTy};
 use syntax::errors::DiagnosticBuilder;
 use syntax::source_map::Span;
+use syntax::symbol::sym;
 
 use crate::consts::{constant, Constant};
 use crate::utils::paths;
@@ -1091,7 +1092,7 @@ fn is_c_void(cx: &LateContext<'_, '_>, ty: Ty<'_>) -> bool {
         if names.is_empty() {
             return false;
         }
-        if names[0] == "libc" || names[0] == "core" && *names.last().unwrap() == "c_void" {
+        if names[0] == sym!(libc) || names[0] == sym::core && *names.last().unwrap() == sym!(c_void) {
             return true;
         }
     }
index 179e006ed058a40fd82fde53c719b1a084707816..a812b1709bbc42b4fe5128e99bacddaea16acbba 100644 (file)
@@ -1123,5 +1123,7 @@ fn test_without_block_comments_lines_without_block_comments() {
 }
 
 pub fn match_def_path<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, did: DefId, syms: &[&str]) -> bool {
+    // HACK: find a way to use symbols from clippy or just go fully to diagnostic items
+    let syms: Vec<_> = syms.iter().map(|sym| Symbol::intern(sym)).collect();
     cx.match_def_path(did, &syms)
 }