Auto merge of #6820 - mgacek8:issue_6562_enhance_mem_replace_with_default_with_other_ctors, r=phansch

mem_replace_with_default: recognize some std library ctors

fixes #6562
changelog: mem_replace_with_default: recognize some common constructors equivalent to `Default::default()`
This commit is contained in:
bors
2021-03-13 15:43:00 +00:00
5 changed files with 166 additions and 8 deletions

View File

@@ -280,7 +280,7 @@ pub fn match_trait_method(cx: &LateContext<'_>, expr: &Expr<'_>, path: &[&str])
trt_id.map_or(false, |trt_id| match_def_path(cx, trt_id, path))
}
/// Checks if the method call given in `expr` belongs to a trait or other container with a given
/// Checks if the method call given in `def_id` belongs to a trait or other container with a given
/// diagnostic item
pub fn is_diagnostic_assoc_item(cx: &LateContext<'_>, def_id: DefId, diag_item: Symbol) -> bool {
cx.tcx