mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 06:28:42 +00:00
Use types rather than strings
This commit is contained in:
parent
350036a0c7
commit
368223a341
1 changed files with 9 additions and 4 deletions
|
@ -48,13 +48,18 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DefaultTraitAccess {
|
|||
then {
|
||||
match qpath {
|
||||
QPath::Resolved(..) => {
|
||||
if let ExprKind::Call(ref method, ref _args) = expr.node {
|
||||
if format!("{:?}", method).contains(" as Default>") {
|
||||
return
|
||||
if_chain! {
|
||||
// Detect and ignore <Foo as Default>::default() because these calls do
|
||||
// explicitly name the type.
|
||||
if let ExprKind::Call(ref method, ref _args) = expr.node;
|
||||
if let ExprKind::Path(ref p) = method.node;
|
||||
if let QPath::Resolved(ref ty, ref _path) = p;
|
||||
if ty.is_some();
|
||||
then {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: Work out a way to put "whatever the imported way of referencing
|
||||
// this type in this file" rather than a fully-qualified type.
|
||||
let expr_ty = cx.tables.expr_ty(expr);
|
||||
|
|
Loading…
Add table
Reference in a new issue