mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 13:43:17 +00:00
Fix the lint in clippy itself
This commit is contained in:
parent
73cd95465e
commit
332e03146e
6 changed files with 11 additions and 5 deletions
|
@ -760,7 +760,7 @@ fn walk_parents<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> (Position, &
|
|||
.and_then(|subs| subs.get(1..))
|
||||
{
|
||||
Some(subs) => cx.tcx.mk_substs(subs.iter().copied()),
|
||||
None => cx.tcx.mk_substs([].iter()),
|
||||
None => cx.tcx.mk_substs(std::iter::empty::<ty::subst::GenericArg<'_>>()),
|
||||
} && let impl_ty = if cx.tcx.fn_sig(id).skip_binder().inputs()[0].is_ref() {
|
||||
// Trait methods taking `&self`
|
||||
sub_ty
|
||||
|
|
|
@ -516,7 +516,10 @@ fn param_env_for_derived_eq(tcx: TyCtxt<'_>, did: DefId, eq_trait_id: DefId) ->
|
|||
tcx.mk_predicates(ty_predicates.iter().map(|&(p, _)| p).chain(
|
||||
params.iter().filter(|&&(_, needs_eq)| needs_eq).map(|&(param, _)| {
|
||||
tcx.mk_predicate(Binder::dummy(PredicateKind::Trait(TraitPredicate {
|
||||
trait_ref: TraitRef::new(eq_trait_id, tcx.mk_substs([tcx.mk_param_from_def(param)].into_iter())),
|
||||
trait_ref: TraitRef::new(
|
||||
eq_trait_id,
|
||||
tcx.mk_substs(std::iter::once(tcx.mk_param_from_def(param))),
|
||||
),
|
||||
constness: BoundConstness::NotConst,
|
||||
polarity: ImplPolarity::Positive,
|
||||
})))
|
||||
|
|
|
@ -11,6 +11,8 @@ use rustc_middle::ty::adjustment::{Adjust, AutoBorrow, AutoBorrowMutability};
|
|||
use rustc_middle::ty::subst::GenericArg;
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
||||
use std::iter;
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
/// Checks for redundant slicing expressions which use the full range, and
|
||||
|
@ -134,7 +136,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantSlicing {
|
|||
} else if let Some(target_id) = cx.tcx.lang_items().deref_target() {
|
||||
if let Ok(deref_ty) = cx.tcx.try_normalize_erasing_regions(
|
||||
cx.param_env,
|
||||
cx.tcx.mk_projection(target_id, cx.tcx.mk_substs([GenericArg::from(indexed_ty)].into_iter())),
|
||||
cx.tcx.mk_projection(target_id, cx.tcx.mk_substs(iter::once(GenericArg::from(indexed_ty)))),
|
||||
) {
|
||||
if deref_ty == expr_ty {
|
||||
let snip = snippet_with_context(cx, indexed.span, ctxt, "..", &mut app).0;
|
||||
|
|
|
@ -490,6 +490,7 @@ impl Types {
|
|||
}
|
||||
}
|
||||
}
|
||||
#[allow(clippy::iter_empty)]
|
||||
match *qpath {
|
||||
QPath::Resolved(Some(ty), p) => {
|
||||
context.is_nested_call = true;
|
||||
|
|
|
@ -350,7 +350,7 @@ define_Conf! {
|
|||
/// Lint: DISALLOWED_SCRIPT_IDENTS.
|
||||
///
|
||||
/// The list of unicode scripts allowed to be used in the scope.
|
||||
(allowed_scripts: Vec<String> = ["Latin"].iter().map(ToString::to_string).collect()),
|
||||
(allowed_scripts: Vec<String> = vec!["Latin".to_string()]),
|
||||
/// Lint: NON_SEND_FIELDS_IN_SEND_TY.
|
||||
///
|
||||
/// Whether to apply the raw pointer heuristic to determine if a type is `Send`.
|
||||
|
|
|
@ -797,7 +797,7 @@ fn get_lint_group_and_level_or_lint(
|
|||
let result = cx.lint_store.check_lint_name(
|
||||
lint_name,
|
||||
Some(sym::clippy),
|
||||
&[Ident::with_dummy_span(sym::clippy)].into_iter().collect(),
|
||||
&std::iter::once(Ident::with_dummy_span(sym::clippy)).collect(),
|
||||
);
|
||||
if let CheckLintNameResult::Tool(Ok(lint_lst)) = result {
|
||||
if let Some(group) = get_lint_group(cx, lint_lst[0]) {
|
||||
|
|
Loading…
Reference in a new issue