-fn check_replace_with_default(cx: &LateContext<'_, '_>, src: &Expr<'_>, dest: &Expr<'_>, expr_span: Span) {
+/// Returns true if the `def_id` associated with the `path` is recognized as a "default-equivalent"
+/// constructor from the std library
+fn is_default_equivalent_ctor(cx: &LateContext<'_>, def_id: DefId, path: &QPath<'_>) -> bool {
+ let std_types_symbols = &[
+ sym::string_type,
+ sym::vec_type,
+ sym::vecdeque_type,
+ sym::LinkedList,
+ sym::hashmap_type,
+ sym::BTreeMap,
+ sym::hashset_type,
+ sym::BTreeSet,
+ sym::BinaryHeap,
+ ];
+
+ if std_types_symbols
+ .iter()
+ .any(|symbol| is_diagnostic_assoc_item(cx, def_id, *symbol))
+ {
+ if let QPath::TypeRelative(_, ref method) = path {
+ if method.ident.name == sym::new {
+ return true;
+ }
+ }
+ }
+
+ false
+}
+
+fn check_replace_with_default(cx: &LateContext<'_>, src: &Expr<'_>, dest: &Expr<'_>, expr_span: Span) {