default_trait_access skips <F as Default>::default()
This includes the type name, so is clear, and may be necessary. There doesn't seem to be an obviously cleaner way to pull out the literal text of the named type here. Fixes #2879
This commit is contained in:
parent
43c629ebac
commit
350036a0c7
@ -48,6 +48,13 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
|
||||
then {
|
||||
match qpath {
|
||||
QPath::Resolved(..) => {
|
||||
if let ExprKind::Call(ref method, ref _args) = expr.node {
|
||||
if format!("{:?}", method).contains(" as Default>") {
|
||||
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);
|
||||
|
@ -41,8 +41,10 @@ fn main() {
|
||||
|
||||
let s18 = TupleStructDerivedDefault::default();
|
||||
|
||||
let s19 = <DerivedDefault as Default>::default();
|
||||
|
||||
println!(
|
||||
"[{}] [{}] [{}] [{}] [{}] [{}] [{}] [{}] [{}] [{:?}] [{:?}] [{:?}] [{:?}] [{:?}] [{:?}] [{:?}] [{:?}] [{:?}]",
|
||||
"[{}] [{}] [{}] [{}] [{}] [{}] [{}] [{}] [{}] [{:?}] [{:?}] [{:?}] [{:?}] [{:?}] [{:?}] [{:?}] [{:?}] [{:?}], [{:?}]",
|
||||
s1,
|
||||
s2,
|
||||
s3,
|
||||
@ -61,6 +63,7 @@ fn main() {
|
||||
s16,
|
||||
s17,
|
||||
s18,
|
||||
s19,
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user