Skip to content

Commit 2b2190c

Browse files
committed
Auto merge of #9323 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents f7e2cb4 + 280b527 commit 2b2190c

36 files changed

+108
-95
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.64"
3+
version = "0.1.65"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_dev/src/new_lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ fn setup_mod_file(path: &Path, lint: &LintData<'_>) -> io::Result<&'static str>
438438
let mut lint_context = None;
439439

440440
let mut iter = rustc_lexer::tokenize(&file_contents).map(|t| {
441-
let range = offset..offset + t.len;
441+
let range = offset..offset + t.len as usize;
442442
offset = range.end;
443443

444444
LintDeclSearchResult {

clippy_dev/src/update_lints.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ pub(crate) struct LintDeclSearchResult<'a> {
836836
fn parse_contents(contents: &str, module: &str, lints: &mut Vec<Lint>) {
837837
let mut offset = 0usize;
838838
let mut iter = tokenize(contents).map(|t| {
839-
let range = offset..offset + t.len;
839+
let range = offset..offset + t.len as usize;
840840
offset = range.end;
841841

842842
LintDeclSearchResult {
@@ -899,7 +899,7 @@ fn parse_contents(contents: &str, module: &str, lints: &mut Vec<Lint>) {
899899
fn parse_deprecated_contents(contents: &str, lints: &mut Vec<DeprecatedLint>) {
900900
let mut offset = 0usize;
901901
let mut iter = tokenize(contents).map(|t| {
902-
let range = offset..offset + t.len;
902+
let range = offset..offset + t.len as usize;
903903
offset = range.end;
904904

905905
LintDeclSearchResult {
@@ -946,7 +946,7 @@ fn parse_renamed_contents(contents: &str, lints: &mut Vec<RenamedLint>) {
946946
for line in contents.lines() {
947947
let mut offset = 0usize;
948948
let mut iter = tokenize(line).map(|t| {
949-
let range = offset..offset + t.len;
949+
let range = offset..offset + t.len as usize;
950950
offset = range.end;
951951

952952
LintDeclSearchResult {

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_lints"
3-
version = "0.1.64"
3+
version = "0.1.65"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_lints/src/crate_in_macro_def.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ fn contains_unhygienic_crate_reference(tts: &TokenStream) -> Option<Span> {
110110

111111
fn is_crate_keyword(tt: &TokenTree) -> Option<Span> {
112112
if_chain! {
113-
if let TokenTree::Token(Token { kind: TokenKind::Ident(symbol, _), span }) = tt;
113+
if let TokenTree::Token(Token { kind: TokenKind::Ident(symbol, _), span }, _) = tt;
114114
if symbol.as_str() == "crate";
115115
then { Some(*span) } else { None }
116116
}
117117
}
118118

119119
fn is_token(tt: &TokenTree, kind: &TokenKind) -> bool {
120-
if let TokenTree::Token(Token { kind: other, .. }) = tt {
120+
if let TokenTree::Token(Token { kind: other, .. }, _) = tt {
121121
kind == other
122122
} else {
123123
false

clippy_lints/src/eta_reduction.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,11 @@ fn check_sig<'tcx>(cx: &LateContext<'tcx>, closure_ty: Ty<'tcx>, call_ty: Ty<'tc
220220
}
221221

222222
fn get_ufcs_type_name(cx: &LateContext<'_>, method_def_id: DefId) -> String {
223-
match cx.tcx.associated_item(method_def_id).container {
224-
ty::TraitContainer(def_id) => cx.tcx.def_path_str(def_id),
225-
ty::ImplContainer(def_id) => {
223+
let assoc_item = cx.tcx.associated_item(method_def_id);
224+
let def_id = assoc_item.container_id(cx.tcx);
225+
match assoc_item.container {
226+
ty::TraitContainer => cx.tcx.def_path_str(def_id),
227+
ty::ImplContainer => {
226228
let ty = cx.tcx.type_of(def_id);
227229
match ty.kind() {
228230
ty::Adt(adt, _) => cx.tcx.def_path_str(adt.did()),

clippy_lints/src/future_not_send.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::ty::{EarlyBinder, Opaque, PredicateKind::Trait};
99
use rustc_session::{declare_lint_pass, declare_tool_lint};
1010
use rustc_span::{sym, Span};
1111
use rustc_trait_selection::traits::error_reporting::suggestions::InferCtxtExt;
12-
use rustc_trait_selection::traits::{self, FulfillmentError, TraitEngine};
12+
use rustc_trait_selection::traits::{self, FulfillmentError};
1313

1414
declare_clippy_lint! {
1515
/// ### What it does
@@ -80,9 +80,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
8080
let span = decl.output.span();
8181
let send_errors = cx.tcx.infer_ctxt().enter(|infcx| {
8282
let cause = traits::ObligationCause::misc(span, hir_id);
83-
let mut fulfillment_cx = traits::FulfillmentContext::new();
84-
fulfillment_cx.register_bound(&infcx, cx.param_env, ret_ty, send_trait, cause);
85-
fulfillment_cx.select_all_or_error(&infcx)
83+
traits::fully_solve_bound(&infcx, cause, cx.param_env, ret_ty, send_trait)
8684
});
8785
if !send_errors.is_empty() {
8886
span_lint_and_then(

clippy_lints/src/matches/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ fn span_contains_cfg(cx: &LateContext<'_>, s: Span) -> bool {
11121112
let mut pos = 0usize;
11131113
let mut iter = tokenize(&snip).map(|t| {
11141114
let start = pos;
1115-
pos += t.len;
1115+
pos += t.len as usize;
11161116
(t.kind, start..pos)
11171117
});
11181118

clippy_lints/src/methods/suspicious_map.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ pub fn check<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, count_recv: &hi
1212
if_chain! {
1313
if is_trait_method(cx, count_recv, sym::Iterator);
1414
let closure = expr_or_init(cx, map_arg);
15-
if let Some(body_id) = cx.tcx.hir().maybe_body_owned_by(closure.hir_id);
15+
if let Some(def_id) = cx.tcx.hir().opt_local_def_id(closure.hir_id);
16+
if let Some(body_id) = cx.tcx.hir().maybe_body_owned_by(def_id);
1617
let closure_body = cx.tcx.hir().body(body_id);
1718
if !cx.typeck_results().expr_ty(&closure_body.value).is_unit();
1819
then {

clippy_lints/src/missing_doc.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use if_chain::if_chain;
1212
use rustc_ast::ast::{self, MetaItem, MetaItemKind};
1313
use rustc_hir as hir;
1414
use rustc_lint::{LateContext, LateLintPass, LintContext};
15-
use rustc_middle::ty::{self, DefIdTree};
15+
use rustc_middle::ty::DefIdTree;
1616
use rustc_session::{declare_tool_lint, impl_lint_pass};
1717
use rustc_span::def_id::CRATE_DEF_ID;
1818
use rustc_span::source_map::Span;
@@ -175,13 +175,12 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
175175

176176
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx hir::ImplItem<'_>) {
177177
// If the method is an impl for a trait, don't doc.
178-
match cx.tcx.associated_item(impl_item.def_id).container {
179-
ty::TraitContainer(_) => return,
180-
ty::ImplContainer(cid) => {
181-
if cx.tcx.impl_trait_ref(cid).is_some() {
182-
return;
183-
}
184-
},
178+
if let Some(cid) = cx.tcx.associated_item(impl_item.def_id).impl_container(cx.tcx) {
179+
if cx.tcx.impl_trait_ref(cid).is_some() {
180+
return;
181+
}
182+
} else {
183+
return;
185184
}
186185

187186
let (article, desc) = cx.tcx.article_and_description(impl_item.def_id.to_def_id());

0 commit comments

Comments
 (0)