Skip to content

Commit ccfbfb8

Browse files
committed
Auto merge of #3860 - phansch:refactor_out_opt_def_id, r=flip1995
Refactor: Remove utils::opt_def_id This removes some indirection. Probably this method was uplifted to rustc at some point?
2 parents 8213d25 + 9d97ed6 commit ccfbfb8

18 files changed

+41
-47
lines changed

clippy_lints/src/attrs.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
33
use crate::reexport::*;
44
use crate::utils::{
5-
in_macro, last_line_of_span, match_def_path, opt_def_id, paths, snippet_opt, span_lint, span_lint_and_sugg,
6-
span_lint_and_then, without_block_comments,
5+
in_macro, last_line_of_span, match_def_path, paths, snippet_opt, span_lint, span_lint_and_sugg, span_lint_and_then,
6+
without_block_comments,
77
};
88
use if_chain::if_chain;
99
use rustc::hir::*;
@@ -396,7 +396,7 @@ fn is_relevant_expr(tcx: TyCtxt<'_, '_, '_>, tables: &ty::TypeckTables<'_>, expr
396396
ExprKind::Ret(None) | ExprKind::Break(_, None) => false,
397397
ExprKind::Call(path_expr, _) => {
398398
if let ExprKind::Path(qpath) = &path_expr.node {
399-
if let Some(fun_id) = opt_def_id(tables.qpath_def(qpath, path_expr.hir_id)) {
399+
if let Some(fun_id) = tables.qpath_def(qpath, path_expr.hir_id).opt_def_id() {
400400
!match_def_path(tcx, fun_id, &paths::BEGIN_PANIC)
401401
} else {
402402
true

clippy_lints/src/default_trait_access.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc::ty;
55
use rustc::{declare_tool_lint, lint_array};
66
use rustc_errors::Applicability;
77

8-
use crate::utils::{any_parent_is_automatically_derived, match_def_path, opt_def_id, paths, span_lint_and_sugg};
8+
use crate::utils::{any_parent_is_automatically_derived, match_def_path, paths, span_lint_and_sugg};
99

1010
declare_clippy_lint! {
1111
/// **What it does:** Checks for literal calls to `Default::default()`.
@@ -47,7 +47,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DefaultTraitAccess {
4747
if let ExprKind::Call(ref path, ..) = expr.node;
4848
if !any_parent_is_automatically_derived(cx.tcx, expr.hir_id);
4949
if let ExprKind::Path(ref qpath) = path.node;
50-
if let Some(def_id) = opt_def_id(cx.tables.qpath_def(qpath, path.hir_id));
50+
if let Some(def_id) = cx.tables.qpath_def(qpath, path.hir_id).opt_def_id();
5151
if match_def_path(cx.tcx, def_id, &paths::DEFAULT_TRAIT_METHOD);
5252
then {
5353
match qpath {

clippy_lints/src/drop_forget_ref.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{is_copy, match_def_path, opt_def_id, paths, span_note_and_lint};
1+
use crate::utils::{is_copy, match_def_path, paths, span_note_and_lint};
22
use if_chain::if_chain;
33
use rustc::hir::*;
44
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
@@ -124,7 +124,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
124124
if let ExprKind::Call(ref path, ref args) = expr.node;
125125
if let ExprKind::Path(ref qpath) = path.node;
126126
if args.len() == 1;
127-
if let Some(def_id) = opt_def_id(cx.tables.qpath_def(qpath, path.hir_id));
127+
if let Some(def_id) = cx.tables.qpath_def(qpath, path.hir_id).opt_def_id();
128128
then {
129129
let lint;
130130
let msg;

clippy_lints/src/explicit_write.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{is_expn_of, match_def_path, opt_def_id, resolve_node, span_lint, span_lint_and_sugg};
1+
use crate::utils::{is_expn_of, match_def_path, resolve_node, span_lint, span_lint_and_sugg};
22
use if_chain::if_chain;
33
use rustc::hir::*;
44
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
@@ -53,7 +53,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
5353
if let ExprKind::Call(ref dest_fun, _) = write_args[0].node;
5454
if let ExprKind::Path(ref qpath) = dest_fun.node;
5555
if let Some(dest_fun_id) =
56-
opt_def_id(resolve_node(cx, qpath, dest_fun.hir_id));
56+
resolve_node(cx, qpath, dest_fun.hir_id).opt_def_id();
5757
if let Some(dest_name) = if match_def_path(cx.tcx, dest_fun_id, &["std", "io", "stdio", "stdout"]) {
5858
Some("stdout")
5959
} else if match_def_path(cx.tcx, dest_fun_id, &["std", "io", "stdio", "stderr"]) {

clippy_lints/src/fallible_impl_from.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::utils::paths::{BEGIN_PANIC, BEGIN_PANIC_FMT, FROM_TRAIT, OPTION, RESULT};
2-
use crate::utils::{is_expn_of, match_def_path, method_chain_args, opt_def_id, span_lint_and_then, walk_ptrs_ty};
2+
use crate::utils::{is_expn_of, match_def_path, method_chain_args, span_lint_and_then, walk_ptrs_ty};
33
use if_chain::if_chain;
44
use rustc::hir;
55
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
@@ -71,7 +71,7 @@ fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_it
7171
if_chain! {
7272
if let ExprKind::Call(ref func_expr, _) = expr.node;
7373
if let ExprKind::Path(QPath::Resolved(_, ref path)) = func_expr.node;
74-
if let Some(path_def_id) = opt_def_id(path.def);
74+
if let Some(path_def_id) = path.def.opt_def_id();
7575
if match_def_path(self.tcx, path_def_id, &BEGIN_PANIC) ||
7676
match_def_path(self.tcx, path_def_id, &BEGIN_PANIC_FMT);
7777
if is_expn_of(expr.span, "unreachable").is_none();

clippy_lints/src/format.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::utils::paths;
22
use crate::utils::{
3-
in_macro, is_expn_of, last_path_segment, match_def_path, match_type, opt_def_id, resolve_node, snippet,
4-
span_lint_and_then, walk_ptrs_ty,
3+
in_macro, is_expn_of, last_path_segment, match_def_path, match_type, resolve_node, snippet, span_lint_and_then,
4+
walk_ptrs_ty,
55
};
66
use if_chain::if_chain;
77
use rustc::hir::*;
@@ -58,7 +58,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
5858
ExprKind::Call(ref fun, ref args) => {
5959
if_chain! {
6060
if let ExprKind::Path(ref qpath) = fun.node;
61-
if let Some(fun_def_id) = opt_def_id(resolve_node(cx, qpath, fun.hir_id));
61+
if let Some(fun_def_id) = resolve_node(cx, qpath, fun.hir_id).opt_def_id();
6262
let new_v1 = match_def_path(cx.tcx, fun_def_id, &paths::FMT_ARGUMENTS_NEWV1);
6363
let new_v1_fmt = match_def_path(
6464
cx.tcx,
@@ -159,7 +159,7 @@ fn get_single_string_arg<'a>(cx: &LateContext<'_, '_>, expr: &'a Expr) -> Option
159159
if let ExprKind::Call(_, ref args) = exprs[0].node;
160160
if args.len() == 2;
161161
if let ExprKind::Path(ref qpath) = args[1].node;
162-
if let Some(fun_def_id) = opt_def_id(resolve_node(cx, qpath, args[1].hir_id));
162+
if let Some(fun_def_id) = resolve_node(cx, qpath, args[1].hir_id).opt_def_id();
163163
if match_def_path(cx.tcx, fun_def_id, &paths::DISPLAY_FMT_METHOD);
164164
then {
165165
let ty = walk_ptrs_ty(cx.tables.pat_ty(&pat[0]));

clippy_lints/src/identity_conversion.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::utils::{
22
in_macro, match_def_path, match_trait_method, same_tys, snippet, snippet_with_macro_callsite, span_lint_and_then,
33
};
4-
use crate::utils::{opt_def_id, paths, resolve_node};
4+
use crate::utils::{paths, resolve_node};
55
use rustc::hir::*;
66
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
77
use rustc::{declare_tool_lint, lint_array};
@@ -98,7 +98,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityConversion {
9898

9999
ExprKind::Call(ref path, ref args) => {
100100
if let ExprKind::Path(ref qpath) = path.node {
101-
if let Some(def_id) = opt_def_id(resolve_node(cx, qpath, path.hir_id)) {
101+
if let Some(def_id) = resolve_node(cx, qpath, path.hir_id).opt_def_id() {
102102
if match_def_path(cx.tcx, def_id, &paths::FROM_FROM[..]) {
103103
let a = cx.tables.expr_ty(e);
104104
let b = cx.tables.expr_ty(&args[0]);

clippy_lints/src/invalid_ref.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{match_def_path, opt_def_id, paths, span_help_and_lint};
1+
use crate::utils::{match_def_path, paths, span_help_and_lint};
22
use if_chain::if_chain;
33
use rustc::hir::*;
44
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
@@ -45,7 +45,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidRef {
4545
if let ExprKind::Path(ref qpath) = path.node;
4646
if args.len() == 0;
4747
if let ty::Ref(..) = cx.tables.expr_ty(expr).sty;
48-
if let Some(def_id) = opt_def_id(cx.tables.qpath_def(qpath, path.hir_id));
48+
if let Some(def_id) = cx.tables.qpath_def(qpath, path.hir_id).opt_def_id();
4949
then {
5050
let msg = if match_def_path(cx.tcx, def_id, &paths::MEM_ZEROED) |
5151
match_def_path(cx.tcx, def_id, &paths::INIT)

clippy_lints/src/mem_discriminant.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{match_def_path, opt_def_id, paths, snippet, span_lint_and_then, walk_ptrs_ty_depth};
1+
use crate::utils::{match_def_path, paths, snippet, span_lint_and_then, walk_ptrs_ty_depth};
22
use if_chain::if_chain;
33
use rustc::hir::{Expr, ExprKind};
44
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
@@ -45,7 +45,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemDiscriminant {
4545
if let ExprKind::Call(ref func, ref func_args) = expr.node;
4646
// is `mem::discriminant`
4747
if let ExprKind::Path(ref func_qpath) = func.node;
48-
if let Some(def_id) = opt_def_id(cx.tables.qpath_def(func_qpath, func.hir_id));
48+
if let Some(def_id) = cx.tables.qpath_def(func_qpath, func.hir_id).opt_def_id();
4949
if match_def_path(cx.tcx, def_id, &paths::MEM_DISCRIMINANT);
5050
// type is non-enum
5151
let ty_param = cx.tables.node_substs(func.hir_id).type_at(0);

clippy_lints/src/mem_forget.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{match_def_path, opt_def_id, paths, span_lint};
1+
use crate::utils::{match_def_path, paths, span_lint};
22
use rustc::hir::{Expr, ExprKind};
33
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
44
use rustc::{declare_tool_lint, lint_array};
@@ -37,7 +37,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemForget {
3737
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
3838
if let ExprKind::Call(ref path_expr, ref args) = e.node {
3939
if let ExprKind::Path(ref qpath) = path_expr.node {
40-
if let Some(def_id) = opt_def_id(cx.tables.qpath_def(qpath, path_expr.hir_id)) {
40+
if let Some(def_id) = cx.tables.qpath_def(qpath, path_expr.hir_id).opt_def_id() {
4141
if match_def_path(cx.tcx, def_id, &paths::MEM_FORGET) {
4242
let forgot_ty = cx.tables.expr_ty(&args[0]);
4343

clippy_lints/src/mem_replace.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{match_def_path, match_qpath, opt_def_id, paths, snippet_with_applicability, span_lint_and_sugg};
1+
use crate::utils::{match_def_path, match_qpath, paths, snippet_with_applicability, span_lint_and_sugg};
22
use if_chain::if_chain;
33
use rustc::hir::{Expr, ExprKind, MutMutable, QPath};
44
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
@@ -51,7 +51,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemReplace {
5151
if let ExprKind::Call(ref func, ref func_args) = expr.node;
5252
if func_args.len() == 2;
5353
if let ExprKind::Path(ref func_qpath) = func.node;
54-
if let Some(def_id) = opt_def_id(cx.tables.qpath_def(func_qpath, func.hir_id));
54+
if let Some(def_id) = cx.tables.qpath_def(func_qpath, func.hir_id).opt_def_id();
5555
if match_def_path(cx.tcx, def_id, &paths::MEM_REPLACE);
5656

5757
// Check that second argument is `Option::None`

clippy_lints/src/minmax.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::consts::{constant_simple, Constant};
2-
use crate::utils::{match_def_path, opt_def_id, paths, span_lint};
2+
use crate::utils::{match_def_path, paths, span_lint};
33
use rustc::hir::*;
44
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
55
use rustc::{declare_tool_lint, lint_array};
@@ -72,7 +72,7 @@ enum MinMax {
7272
fn min_max<'a>(cx: &LateContext<'_, '_>, expr: &'a Expr) -> Option<(MinMax, Constant, &'a Expr)> {
7373
if let ExprKind::Call(ref path, ref args) = expr.node {
7474
if let ExprKind::Path(ref qpath) = path.node {
75-
opt_def_id(cx.tables.qpath_def(qpath, path.hir_id)).and_then(|def_id| {
75+
cx.tables.qpath_def(qpath, path.hir_id).opt_def_id().and_then(|def_id| {
7676
if match_def_path(cx.tcx, def_id, &paths::CMP_MIN) {
7777
fetch_const(cx, args, MinMax::Min)
7878
} else if match_def_path(cx.tcx, def_id, &paths::CMP_MAX) {

clippy_lints/src/panic_unimplemented.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{is_direct_expn_of, is_expn_of, match_def_path, opt_def_id, paths, resolve_node, span_lint};
1+
use crate::utils::{is_direct_expn_of, is_expn_of, match_def_path, paths, resolve_node, span_lint};
22
use if_chain::if_chain;
33
use rustc::hir::*;
44
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
@@ -61,7 +61,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
6161
if let Some(ref ex) = block.expr;
6262
if let ExprKind::Call(ref fun, ref params) = ex.node;
6363
if let ExprKind::Path(ref qpath) = fun.node;
64-
if let Some(fun_def_id) = opt_def_id(resolve_node(cx, qpath, fun.hir_id));
64+
if let Some(fun_def_id) = resolve_node(cx, qpath, fun.hir_id).opt_def_id();
6565
if match_def_path(cx.tcx, fun_def_id, &paths::BEGIN_PANIC);
6666
if params.len() == 2;
6767
then {

clippy_lints/src/regex.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::consts::{constant, Constant};
2-
use crate::utils::{is_expn_of, match_def_path, match_type, opt_def_id, paths, span_help_and_lint, span_lint};
2+
use crate::utils::{is_expn_of, match_def_path, match_type, paths, span_help_and_lint, span_lint};
33
use if_chain::if_chain;
44
use regex_syntax;
55
use rustc::hir::*;
@@ -118,7 +118,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
118118
if let ExprKind::Call(ref fun, ref args) = expr.node;
119119
if let ExprKind::Path(ref qpath) = fun.node;
120120
if args.len() == 1;
121-
if let Some(def_id) = opt_def_id(cx.tables.qpath_def(qpath, fun.hir_id));
121+
if let Some(def_id) = cx.tables.qpath_def(qpath, fun.hir_id).opt_def_id();
122122
then {
123123
if match_def_path(cx.tcx, def_id, &paths::REGEX_NEW) ||
124124
match_def_path(cx.tcx, def_id, &paths::REGEX_BUILDER_NEW) {

clippy_lints/src/transmute.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use crate::utils::{last_path_segment, match_def_path, paths, snippet, span_lint, span_lint_and_then};
2-
use crate::utils::{opt_def_id, sugg};
1+
use crate::utils::{last_path_segment, match_def_path, paths, snippet, span_lint, span_lint_and_then, sugg};
32
use if_chain::if_chain;
43
use rustc::hir::*;
54
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
@@ -231,7 +230,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute {
231230
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
232231
if let ExprKind::Call(ref path_expr, ref args) = e.node {
233232
if let ExprKind::Path(ref qpath) = path_expr.node {
234-
if let Some(def_id) = opt_def_id(cx.tables.qpath_def(qpath, path_expr.hir_id)) {
233+
if let Some(def_id) = cx.tables.qpath_def(qpath, path_expr.hir_id).opt_def_id() {
235234
if match_def_path(cx.tcx, def_id, &paths::TRANSMUTE) {
236235
let from_ty = cx.tables.expr_ty(&args[0]);
237236
let to_ty = cx.tables.expr_ty(e);

clippy_lints/src/types.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ use crate::consts::{constant, Constant};
44
use crate::utils::paths;
55
use crate::utils::{
66
clip, comparisons, differing_macro_contexts, higher, in_constant, in_macro, int_bits, last_path_segment,
7-
match_def_path, match_path, multispan_sugg, opt_def_id, same_tys, sext, snippet, snippet_opt,
8-
snippet_with_applicability, span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then, unsext,
9-
AbsolutePathBuffer,
7+
match_def_path, match_path, multispan_sugg, same_tys, sext, snippet, snippet_opt, snippet_with_applicability,
8+
span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then, unsext, AbsolutePathBuffer,
109
};
1110
use if_chain::if_chain;
1211
use rustc::hir;
@@ -225,7 +224,7 @@ fn match_type_parameter(cx: &LateContext<'_, '_>, qpath: &QPath, path: &[&str])
225224
_ => None,
226225
});
227226
if let TyKind::Path(ref qpath) = ty.node;
228-
if let Some(did) = opt_def_id(cx.tables.qpath_def(qpath, ty.hir_id));
227+
if let Some(did) = cx.tables.qpath_def(qpath, ty.hir_id).opt_def_id();
229228
if match_def_path(cx.tcx, did, path);
230229
then {
231230
return true;
@@ -248,7 +247,7 @@ fn check_ty(cx: &LateContext<'_, '_>, hir_ty: &hir::Ty, is_local: bool) {
248247
TyKind::Path(ref qpath) if !is_local => {
249248
let hir_id = hir_ty.hir_id;
250249
let def = cx.tables.qpath_def(qpath, hir_id);
251-
if let Some(def_id) = opt_def_id(def) {
250+
if let Some(def_id) = def.opt_def_id() {
252251
if Some(def_id) == cx.tcx.lang_items().owned_box() {
253252
if match_type_parameter(cx, qpath, &paths::VEC) {
254253
span_help_and_lint(
@@ -271,7 +270,7 @@ fn check_ty(cx: &LateContext<'_, '_>, hir_ty: &hir::Ty, is_local: bool) {
271270
// ty is now _ at this point
272271
if let TyKind::Path(ref ty_qpath) = ty.node;
273272
let def = cx.tables.qpath_def(ty_qpath, ty.hir_id);
274-
if let Some(def_id) = opt_def_id(def);
273+
if let Some(def_id) = def.opt_def_id();
275274
if Some(def_id) == cx.tcx.lang_items().owned_box();
276275
// At this point, we know ty is Box<T>, now get T
277276
if let Some(ref last) = last_path_segment(ty_qpath).args;
@@ -378,7 +377,7 @@ fn check_ty_rptr(cx: &LateContext<'_, '_>, hir_ty: &hir::Ty, is_local: bool, lt:
378377
let hir_id = mut_ty.ty.hir_id;
379378
let def = cx.tables.qpath_def(qpath, hir_id);
380379
if_chain! {
381-
if let Some(def_id) = opt_def_id(def);
380+
if let Some(def_id) = def.opt_def_id();
382381
if Some(def_id) == cx.tcx.lang_items().owned_box();
383382
if let QPath::Resolved(None, ref path) = *qpath;
384383
if let [ref bx] = *path.segments;

clippy_lints/src/utils/higher.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
#![deny(clippy::missing_docs_in_private_items)]
55

6-
use crate::utils::{is_expn_of, match_def_path, match_qpath, opt_def_id, paths, resolve_node};
6+
use crate::utils::{is_expn_of, match_def_path, match_qpath, paths, resolve_node};
77
use if_chain::if_chain;
88
use rustc::lint::LateContext;
99
use rustc::{hir, ty};
@@ -214,7 +214,7 @@ pub fn vec_macro<'e>(cx: &LateContext<'_, '_>, expr: &'e hir::Expr) -> Option<Ve
214214
if let hir::ExprKind::Call(ref fun, ref args) = expr.node;
215215
if let hir::ExprKind::Path(ref path) = fun.node;
216216
if is_expn_of(fun.span, "vec").is_some();
217-
if let Some(fun_def_id) = opt_def_id(resolve_node(cx, path, fun.hir_id));
217+
if let Some(fun_def_id) = resolve_node(cx, path, fun.hir_id).opt_def_id();
218218
then {
219219
return if match_def_path(cx.tcx, fun_def_id, &paths::VEC_FROM_ELEM) && args.len() == 2 {
220220
// `vec![elem; size]` case

clippy_lints/src/utils/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -845,10 +845,6 @@ pub fn remove_blocks(expr: &Expr) -> &Expr {
845845
}
846846
}
847847

848-
pub fn opt_def_id(def: Def) -> Option<DefId> {
849-
def.opt_def_id()
850-
}
851-
852848
pub fn is_self(slf: &Arg) -> bool {
853849
if let PatKind::Binding(.., name, _) = slf.pat.node {
854850
name.name == keywords::SelfLower.name()

0 commit comments

Comments
 (0)