mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-18 09:03:18 +00:00
Rustup to rust-lang/rust#67970
This commit is contained in:
parent
c092068996
commit
fa33681d5c
2 changed files with 5 additions and 2 deletions
|
@ -9,6 +9,7 @@ use rustc::declare_lint_pass;
|
||||||
use rustc::hir::intravisit::FnKind;
|
use rustc::hir::intravisit::FnKind;
|
||||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||||
use rustc::traits;
|
use rustc::traits;
|
||||||
|
use rustc::traits::misc::can_type_implement_copy;
|
||||||
use rustc::ty::{self, RegionKind, TypeFoldable};
|
use rustc::ty::{self, RegionKind, TypeFoldable};
|
||||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
|
@ -205,7 +206,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
|
||||||
let sugg = |db: &mut DiagnosticBuilder<'_>| {
|
let sugg = |db: &mut DiagnosticBuilder<'_>| {
|
||||||
if let ty::Adt(def, ..) = ty.kind {
|
if let ty::Adt(def, ..) = ty.kind {
|
||||||
if let Some(span) = cx.tcx.hir().span_if_local(def.did) {
|
if let Some(span) = cx.tcx.hir().span_if_local(def.did) {
|
||||||
if cx.param_env.can_type_implement_copy(cx.tcx, ty).is_ok() {
|
if can_type_implement_copy(cx.tcx, cx.param_env, ty).is_ok() {
|
||||||
db.span_help(span, "consider marking this type as `Copy`");
|
db.span_help(span, "consider marking this type as `Copy`");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ use matches::matches;
|
||||||
use rustc::hir::intravisit::{NestedVisitorMap, Visitor};
|
use rustc::hir::intravisit::{NestedVisitorMap, Visitor};
|
||||||
use rustc::lint::{LateContext, Level, Lint, LintContext};
|
use rustc::lint::{LateContext, Level, Lint, LintContext};
|
||||||
use rustc::traits;
|
use rustc::traits;
|
||||||
|
use rustc::traits::predicate_for_trait_def;
|
||||||
use rustc::ty::{
|
use rustc::ty::{
|
||||||
self,
|
self,
|
||||||
layout::{self, IntegerExt},
|
layout::{self, IntegerExt},
|
||||||
|
@ -312,7 +313,8 @@ pub fn implements_trait<'a, 'tcx>(
|
||||||
ty_params: &[GenericArg<'tcx>],
|
ty_params: &[GenericArg<'tcx>],
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let ty = cx.tcx.erase_regions(&ty);
|
let ty = cx.tcx.erase_regions(&ty);
|
||||||
let obligation = cx.tcx.predicate_for_trait_def(
|
let obligation = predicate_for_trait_def(
|
||||||
|
cx.tcx,
|
||||||
cx.param_env,
|
cx.param_env,
|
||||||
traits::ObligationCause::dummy(),
|
traits::ObligationCause::dummy(),
|
||||||
trait_id,
|
trait_id,
|
||||||
|
|
Loading…
Reference in a new issue