Skip to content

Commit e294f94

Browse files
authored
Rustup (#14647)
r? @ghost changelog: none
2 parents 94f0994 + 8a0b225 commit e294f94

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+199
-125
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ path = "src/driver.rs"
2525
[dependencies]
2626
clippy_config = { path = "clippy_config" }
2727
clippy_lints = { path = "clippy_lints" }
28+
clippy_utils = { path = "clippy_utils" }
2829
rustc_tools_util = { path = "rustc_tools_util", version = "0.4.2" }
2930
tempfile = { version = "3.3", optional = true }
3031
termize = "0.1"

clippy_dev/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#[allow(unused_extern_crates)]
1414
extern crate rustc_driver;
1515
extern crate rustc_lexer;
16+
extern crate rustc_literal_escaper;
1617

1718
pub mod dogfood;
1819
pub mod fmt;

clippy_dev/src/update_lints.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use crate::utils::{UpdateMode, clippy_project_root, exit_with_failure, replace_region_in_file};
22
use aho_corasick::AhoCorasickBuilder;
33
use itertools::Itertools;
4-
use rustc_lexer::{LiteralKind, TokenKind, tokenize, unescape};
4+
use rustc_lexer::{LiteralKind, TokenKind, tokenize};
5+
use rustc_literal_escaper::{Mode, unescape_unicode};
56
use std::collections::{HashMap, HashSet};
67
use std::ffi::OsStr;
78
use std::fmt::{self, Write};
@@ -830,7 +831,7 @@ fn remove_line_splices(s: &str) -> String {
830831
.and_then(|s| s.strip_suffix('"'))
831832
.unwrap_or_else(|| panic!("expected quoted string, found `{s}`"));
832833
let mut res = String::with_capacity(s.len());
833-
unescape::unescape_unicode(s, unescape::Mode::Str, &mut |range, ch| {
834+
unescape_unicode(s, Mode::Str, &mut |range, ch| {
834835
if ch.is_ok() {
835836
res.push_str(&s[range]);
836837
}

clippy_lints/src/assigning_clones.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ impl<'tcx> LateLintPass<'tcx> for AssigningClones {
111111
// Only suggest if `clone_from`/`clone_into` is explicitly implemented
112112
&& resolved_assoc_items.in_definition_order().any(|assoc|
113113
match which_trait {
114-
CloneTrait::Clone => assoc.name == sym::clone_from,
115-
CloneTrait::ToOwned => assoc.name.as_str() == "clone_into",
114+
CloneTrait::Clone => assoc.name() == sym::clone_from,
115+
CloneTrait::ToOwned => assoc.name().as_str() == "clone_into",
116116
}
117117
)
118118
&& !clone_source_borrows_from_dest(cx, lhs, rhs.span)

clippy_lints/src/attrs/deprecated_cfg_attr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use super::{Attribute, DEPRECATED_CFG_ATTR, DEPRECATED_CLIPPY_CFG_ATTR, unnecessary_clippy_cfg};
22
use clippy_utils::diagnostics::span_lint_and_sugg;
33
use clippy_utils::msrvs::{self, MsrvStack};
4+
use clippy_utils::sym;
45
use rustc_ast::AttrStyle;
56
use rustc_errors::Applicability;
67
use rustc_lint::EarlyContext;
7-
use rustc_span::sym;
88

99
pub(super) fn check(cx: &EarlyContext<'_>, attr: &Attribute, msrv: &MsrvStack) {
1010
// check cfg_attr
@@ -18,7 +18,7 @@ pub(super) fn check(cx: &EarlyContext<'_>, attr: &Attribute, msrv: &MsrvStack) {
1818
&& msrv.meets(msrvs::TOOL_ATTRIBUTES)
1919
// check for `rustfmt_skip` and `rustfmt::skip`
2020
&& let Some(skip_item) = &items[1].meta_item()
21-
&& (skip_item.has_name(sym!(rustfmt_skip))
21+
&& (skip_item.has_name(sym::rustfmt_skip)
2222
|| skip_item
2323
.path
2424
.segments

clippy_lints/src/attrs/useless_attribute.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use super::USELESS_ATTRIBUTE;
22
use super::utils::{is_lint_level, is_word, namespace_and_lint};
33
use clippy_utils::diagnostics::span_lint_and_then;
44
use clippy_utils::source::{SpanRangeExt, first_line_of_span};
5+
use clippy_utils::sym;
56
use rustc_ast::{Attribute, Item, ItemKind};
67
use rustc_errors::Applicability;
78
use rustc_lint::{EarlyContext, LintContext};
8-
use rustc_span::sym;
99

1010
pub(super) fn check(cx: &EarlyContext<'_>, item: &Item, attrs: &[Attribute]) {
1111
let skip_unused_imports = attrs.iter().any(|attr| attr.has_name(sym::macro_use));
@@ -62,7 +62,7 @@ pub(super) fn check(cx: &EarlyContext<'_>, item: &Item, attrs: &[Attribute]) {
6262
if is_word(lint, sym::unused_imports) && skip_unused_imports {
6363
return;
6464
}
65-
if is_word(lint, sym!(unused_extern_crates)) {
65+
if is_word(lint, sym::unused_extern_crates) {
6666
return;
6767
}
6868
},

clippy_lints/src/bool_assert_comparison.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ fn is_impl_not_trait_with_bool_out<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -
5353
.not_trait()
5454
.filter(|trait_id| implements_trait(cx, ty, *trait_id, &[]))
5555
.and_then(|trait_id| {
56-
cx.tcx.associated_items(trait_id).find_by_name_and_kind(
56+
cx.tcx.associated_items(trait_id).find_by_ident_and_kind(
5757
cx.tcx,
5858
Ident::from_str("Output"),
59-
ty::AssocKind::Type,
59+
ty::AssocTag::Type,
6060
trait_id,
6161
)
6262
})

clippy_lints/src/booleans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ fn check_simplify_not(cx: &LateContext<'_>, msrv: Msrv, expr: &Expr<'_>) {
199199
&& !expr.span.from_expansion()
200200
&& !inner.span.from_expansion()
201201
&& let Some(suggestion) = simplify_not(cx, msrv, inner)
202-
&& cx.tcx.lint_level_at_node(NONMINIMAL_BOOL, expr.hir_id).0 != Level::Allow
202+
&& cx.tcx.lint_level_at_node(NONMINIMAL_BOOL, expr.hir_id).level != Level::Allow
203203
{
204204
use clippy_utils::sugg::{Sugg, has_enclosing_paren};
205205
let maybe_par = if let Some(sug) = Sugg::hir_opt(cx, inner) {
@@ -609,7 +609,7 @@ impl<'tcx> NonminimalBoolVisitor<'_, 'tcx> {
609609
}
610610
}
611611
let nonminimal_bool_lint = |mut suggestions: Vec<_>| {
612-
if self.cx.tcx.lint_level_at_node(NONMINIMAL_BOOL, e.hir_id).0 != Level::Allow {
612+
if self.cx.tcx.lint_level_at_node(NONMINIMAL_BOOL, e.hir_id).level != Level::Allow {
613613
suggestions.sort();
614614
span_lint_hir_and_then(
615615
self.cx,

clippy_lints/src/disallowed_script_idents.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl EarlyLintPass for DisallowedScriptIdents {
6969
// Implementation is heavily inspired by the implementation of [`non_ascii_idents`] lint:
7070
// https://github.com/rust-lang/rust/blob/master/compiler/rustc_lint/src/non_ascii_idents.rs
7171

72-
let check_disallowed_script_idents = cx.builder.lint_level(DISALLOWED_SCRIPT_IDENTS).0 != Level::Allow;
72+
let check_disallowed_script_idents = cx.builder.lint_level(DISALLOWED_SCRIPT_IDENTS).level != Level::Allow;
7373
if !check_disallowed_script_idents {
7474
return;
7575
}

clippy_lints/src/doc/needless_doctest_main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn check(
3838
// of all `#[test]` attributes in not ignored code examples
3939
fn check_code_sample(code: String, edition: Edition, ignore: bool) -> (bool, Vec<Range<usize>>) {
4040
rustc_driver::catch_fatal_errors(|| {
41-
rustc_span::create_session_globals_then(edition, None, || {
41+
rustc_span::create_session_globals_then(edition, &[], None, || {
4242
let mut test_attr_spans = vec![];
4343
let filename = FileName::anon_source_code(&code);
4444

0 commit comments

Comments
 (0)