Skip to content

Commit d95bdcf

Browse files
authored
Rename Sugg::maybe_par() into Sugg::maybe_paren() (rust-lang#14457)
"paren" is used throughout the Clippy codebase as an abbreviation for "parentheses". changelog: none
2 parents 9d78426 + 962329f commit d95bdcf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+89
-79
lines changed

clippy_lints/src/assigning_clones.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ fn build_sugg<'tcx>(
243243
// `lhs = self_expr.clone();` -> `lhs.clone_from(self_expr)`
244244
Sugg::hir_with_applicability(cx, lhs, "_", app)
245245
}
246-
.maybe_par();
246+
.maybe_paren();
247247

248248
// Determine whether we need to reference the argument to clone_from().
249249
let clone_receiver_type = cx.typeck_results().expr_ty(fn_arg);
@@ -284,7 +284,7 @@ fn build_sugg<'tcx>(
284284
let rhs_sugg = if let ExprKind::Unary(hir::UnOp::Deref, ref_expr) = lhs.kind {
285285
// `*lhs = rhs.to_owned()` -> `rhs.clone_into(lhs)`
286286
// `*lhs = ToOwned::to_owned(rhs)` -> `ToOwned::clone_into(rhs, lhs)`
287-
let sugg = Sugg::hir_with_applicability(cx, ref_expr, "_", app).maybe_par();
287+
let sugg = Sugg::hir_with_applicability(cx, ref_expr, "_", app).maybe_paren();
288288
let inner_type = cx.typeck_results().expr_ty(ref_expr);
289289
// If after unwrapping the dereference, the type is not a mutable reference, we add &mut to make it
290290
// deref to a mutable reference.
@@ -296,7 +296,7 @@ fn build_sugg<'tcx>(
296296
} else {
297297
// `lhs = rhs.to_owned()` -> `rhs.clone_into(&mut lhs)`
298298
// `lhs = ToOwned::to_owned(rhs)` -> `ToOwned::clone_into(rhs, &mut lhs)`
299-
Sugg::hir_with_applicability(cx, lhs, "_", app).maybe_par().mut_addr()
299+
Sugg::hir_with_applicability(cx, lhs, "_", app).maybe_paren().mut_addr()
300300
};
301301

302302
match call_kind {

clippy_lints/src/bool_to_int_with_if.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<'tcx> LateLintPass<'tcx> for BoolToIntWithIf {
7272
s
7373
};
7474

75-
let into_snippet = snippet.clone().maybe_par();
75+
let into_snippet = snippet.clone().maybe_paren();
7676
let as_snippet = snippet.as_ty(ty);
7777

7878
span_lint_and_then(

clippy_lints/src/casts/cast_abs_to_unsigned.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub(super) fn check(
3636
span,
3737
format!("casting the result of `{cast_from}::abs()` to {cast_to}"),
3838
"replace with",
39-
format!("{}.unsigned_abs()", Sugg::hir(cx, receiver, "..").maybe_par()),
39+
format!("{}.unsigned_abs()", Sugg::hir(cx, receiver, "..").maybe_paren()),
4040
Applicability::MachineApplicable,
4141
);
4242
}

clippy_lints/src/casts/cast_lossless.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub(super) fn check(
4242
diag.span_suggestion_verbose(
4343
expr.span,
4444
"use `Into::into` instead",
45-
format!("{}.into()", from_sugg.maybe_par()),
45+
format!("{}.into()", from_sugg.maybe_paren()),
4646
applicability,
4747
);
4848
},

clippy_lints/src/casts/cast_possible_truncation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ fn offer_suggestion(
185185
) {
186186
let cast_to_snip = snippet(cx, cast_to_span, "..");
187187
let suggestion = if cast_to_snip == "_" {
188-
format!("{}.try_into()", Sugg::hir(cx, cast_expr, "..").maybe_par())
188+
format!("{}.try_into()", Sugg::hir(cx, cast_expr, "..").maybe_paren())
189189
} else {
190190
format!("{cast_to_snip}::try_from({})", Sugg::hir(cx, cast_expr, ".."))
191191
};

clippy_lints/src/casts/ptr_as_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, msrv: Msrv) {
8181

8282
(
8383
"try `pointer::cast`, a safer alternative",
84-
format!("{}.cast{turbofish}()", cast_expr_sugg.maybe_par()),
84+
format!("{}.cast{turbofish}()", cast_expr_sugg.maybe_paren()),
8585
)
8686
};
8787

clippy_lints/src/casts/ptr_cast_constness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub(super) fn check<'tcx>(
6565
expr.span,
6666
"`as` casting between raw pointers while changing only its constness",
6767
format!("try `pointer::cast_{constness}`, a safer alternative"),
68-
format!("{}.cast_{constness}()", sugg.maybe_par()),
68+
format!("{}.cast_{constness}()", sugg.maybe_paren()),
6969
Applicability::MachineApplicable,
7070
);
7171
}

clippy_lints/src/comparison_chain.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl<'tcx> LateLintPass<'tcx> for ComparisonChain {
125125
let ExprKind::Binary(_, lhs, rhs) = conds[0].kind else {
126126
unreachable!();
127127
};
128-
let lhs = Sugg::hir(cx, lhs, "..").maybe_par();
128+
let lhs = Sugg::hir(cx, lhs, "..").maybe_paren();
129129
let rhs = Sugg::hir(cx, rhs, "..").addr();
130130
span_lint_and_sugg(
131131
cx,

clippy_lints/src/floating_point_arithmetic.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fn prepare_receiver_sugg<'a>(cx: &LateContext<'_>, mut expr: &'a Expr<'a>) -> Su
154154
};
155155
}
156156

157-
suggestion.maybe_par()
157+
suggestion.maybe_paren()
158158
}
159159

160160
fn check_log_base(cx: &LateContext<'_>, expr: &Expr<'_>, receiver: &Expr<'_>, args: &[Expr<'_>]) {
@@ -165,7 +165,7 @@ fn check_log_base(cx: &LateContext<'_>, expr: &Expr<'_>, receiver: &Expr<'_>, ar
165165
expr.span,
166166
"logarithm for bases 2, 10 and e can be computed more accurately",
167167
"consider using",
168-
format!("{}.{method}()", Sugg::hir(cx, receiver, "..").maybe_par()),
168+
format!("{}.{method}()", Sugg::hir(cx, receiver, "..").maybe_paren()),
169169
Applicability::MachineApplicable,
170170
);
171171
}
@@ -254,21 +254,21 @@ fn check_powf(cx: &LateContext<'_>, expr: &Expr<'_>, receiver: &Expr<'_>, args:
254254
(
255255
SUBOPTIMAL_FLOPS,
256256
"square-root of a number can be computed more efficiently and accurately",
257-
format!("{}.sqrt()", Sugg::hir(cx, receiver, "..").maybe_par()),
257+
format!("{}.sqrt()", Sugg::hir(cx, receiver, "..").maybe_paren()),
258258
)
259259
} else if F32(1.0 / 3.0) == value || F64(1.0 / 3.0) == value {
260260
(
261261
IMPRECISE_FLOPS,
262262
"cube-root of a number can be computed more accurately",
263-
format!("{}.cbrt()", Sugg::hir(cx, receiver, "..").maybe_par()),
263+
format!("{}.cbrt()", Sugg::hir(cx, receiver, "..").maybe_paren()),
264264
)
265265
} else if let Some(exponent) = get_integer_from_float_constant(&value) {
266266
(
267267
SUBOPTIMAL_FLOPS,
268268
"exponentiation with integer powers can be computed more efficiently",
269269
format!(
270270
"{}.powi({})",
271-
Sugg::hir(cx, receiver, "..").maybe_par(),
271+
Sugg::hir(cx, receiver, "..").maybe_paren(),
272272
numeric_literal::format(&exponent.to_string(), None, false)
273273
),
274274
)
@@ -330,7 +330,7 @@ fn check_powi(cx: &LateContext<'_>, expr: &Expr<'_>, receiver: &Expr<'_>, args:
330330
"consider using",
331331
format!(
332332
"{}.mul_add({}, {})",
333-
Sugg::hir(cx, receiver, "..").maybe_par(),
333+
Sugg::hir(cx, receiver, "..").maybe_paren(),
334334
maybe_neg_sugg(receiver, expr.hir_id),
335335
maybe_neg_sugg(other_addend, other_addend.hir_id),
336336
),
@@ -371,7 +371,7 @@ fn detect_hypot(cx: &LateContext<'_>, receiver: &Expr<'_>) -> Option<String> {
371371
{
372372
return Some(format!(
373373
"{}.hypot({})",
374-
Sugg::hir(cx, lmul_lhs, "..").maybe_par(),
374+
Sugg::hir(cx, lmul_lhs, "..").maybe_paren(),
375375
Sugg::hir(cx, rmul_lhs, "..")
376376
));
377377
}
@@ -403,7 +403,7 @@ fn detect_hypot(cx: &LateContext<'_>, receiver: &Expr<'_>) -> Option<String> {
403403
{
404404
return Some(format!(
405405
"{}.hypot({})",
406-
Sugg::hir(cx, largs_0, "..").maybe_par(),
406+
Sugg::hir(cx, largs_0, "..").maybe_paren(),
407407
Sugg::hir(cx, rargs_0, "..")
408408
));
409409
}
@@ -449,7 +449,7 @@ fn check_expm1(cx: &LateContext<'_>, expr: &Expr<'_>) {
449449
expr.span,
450450
"(e.pow(x) - 1) can be computed more accurately",
451451
"consider using",
452-
format!("{}.exp_m1()", Sugg::hir(cx, self_arg, "..").maybe_par()),
452+
format!("{}.exp_m1()", Sugg::hir(cx, self_arg, "..").maybe_paren()),
453453
Applicability::MachineApplicable,
454454
);
455455
}
@@ -591,11 +591,11 @@ fn check_custom_abs(cx: &LateContext<'_>, expr: &Expr<'_>) {
591591
{
592592
let positive_abs_sugg = (
593593
"manual implementation of `abs` method",
594-
format!("{}.abs()", Sugg::hir(cx, body, "..").maybe_par()),
594+
format!("{}.abs()", Sugg::hir(cx, body, "..").maybe_paren()),
595595
);
596596
let negative_abs_sugg = (
597597
"manual implementation of negation of `abs` method",
598-
format!("-{}.abs()", Sugg::hir(cx, body, "..").maybe_par()),
598+
format!("-{}.abs()", Sugg::hir(cx, body, "..").maybe_paren()),
599599
);
600600
let sugg = if is_testing_positive(cx, cond, body) {
601601
if if_expr_positive {
@@ -672,7 +672,7 @@ fn check_log_division(cx: &LateContext<'_>, expr: &Expr<'_>) {
672672
"consider using",
673673
format!(
674674
"{}.log({})",
675-
Sugg::hir(cx, largs_self, "..").maybe_par(),
675+
Sugg::hir(cx, largs_self, "..").maybe_paren(),
676676
Sugg::hir(cx, rargs_self, ".."),
677677
),
678678
Applicability::MachineApplicable,
@@ -703,7 +703,7 @@ fn check_radians(cx: &LateContext<'_>, expr: &Expr<'_>) {
703703
if (F32(f32_consts::PI) == rvalue || F64(f64_consts::PI) == rvalue)
704704
&& (F32(180_f32) == lvalue || F64(180_f64) == lvalue)
705705
{
706-
let mut proposal = format!("{}.to_degrees()", Sugg::hir(cx, mul_lhs, "..").maybe_par());
706+
let mut proposal = format!("{}.to_degrees()", Sugg::hir(cx, mul_lhs, "..").maybe_paren());
707707
if let ExprKind::Lit(literal) = mul_lhs.kind
708708
&& let ast::LitKind::Float(ref value, float_type) = literal.node
709709
&& float_type == ast::LitFloatType::Unsuffixed
@@ -726,7 +726,7 @@ fn check_radians(cx: &LateContext<'_>, expr: &Expr<'_>) {
726726
} else if (F32(180_f32) == rvalue || F64(180_f64) == rvalue)
727727
&& (F32(f32_consts::PI) == lvalue || F64(f64_consts::PI) == lvalue)
728728
{
729-
let mut proposal = format!("{}.to_radians()", Sugg::hir(cx, mul_lhs, "..").maybe_par());
729+
let mut proposal = format!("{}.to_radians()", Sugg::hir(cx, mul_lhs, "..").maybe_paren());
730730
if let ExprKind::Lit(literal) = mul_lhs.kind
731731
&& let ast::LitKind::Float(ref value, float_type) = literal.node
732732
&& float_type == ast::LitFloatType::Unsuffixed

clippy_lints/src/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl<'tcx> LateLintPass<'tcx> for UselessFormat {
9494
.into_owned()
9595
} else {
9696
let sugg = Sugg::hir_with_context(cx, value, call_site.ctxt(), "<arg>", &mut applicability);
97-
format!("{}.to_string()", sugg.maybe_par())
97+
format!("{}.to_string()", sugg.maybe_paren())
9898
};
9999
span_useless_format(cx, call_site, sugg, applicability);
100100
}

clippy_lints/src/from_str_radix_10.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<'tcx> LateLintPass<'tcx> for FromStrRadix10 {
7373
};
7474

7575
let sugg =
76-
Sugg::hir_with_applicability(cx, expr, "<string>", &mut Applicability::MachineApplicable).maybe_par();
76+
Sugg::hir_with_applicability(cx, expr, "<string>", &mut Applicability::MachineApplicable).maybe_paren();
7777

7878
span_lint_and_sugg(
7979
cx,

clippy_lints/src/if_then_some_else_none.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl<'tcx> LateLintPass<'tcx> for IfThenSomeElseNone {
9494
|diag| {
9595
let mut app = Applicability::MachineApplicable;
9696
let cond_snip = Sugg::hir_with_context(cx, cond, expr.span.ctxt(), "[condition]", &mut app)
97-
.maybe_par()
97+
.maybe_paren()
9898
.to_string();
9999
let arg_snip = snippet_with_context(cx, then_arg.span, ctxt, "[body]", &mut app).0;
100100
let method_body = if let Some(first_stmt) = then_block.stmts.first() {

clippy_lints/src/implicit_saturating_sub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ fn check_subtraction(
239239
// This part of the condition is voluntarily split from the one before to ensure that
240240
// if `snippet_opt` fails, it won't try the next conditions.
241241
if (!is_in_const_context(cx) || msrv.meets(cx, msrvs::SATURATING_SUB_CONST))
242-
&& let Some(big_expr_sugg) = Sugg::hir_opt(cx, big_expr).map(Sugg::maybe_par)
242+
&& let Some(big_expr_sugg) = Sugg::hir_opt(cx, big_expr).map(Sugg::maybe_paren)
243243
&& let Some(little_expr_sugg) = Sugg::hir_opt(cx, little_expr)
244244
{
245245
let sugg = format!(

clippy_lints/src/instant_subtraction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ fn print_manual_instant_elapsed_sugg(cx: &LateContext<'_>, expr: &Expr<'_>, sugg
123123
expr.span,
124124
"manual implementation of `Instant::elapsed`",
125125
"try",
126-
format!("{}.elapsed()", sugg.maybe_par()),
126+
format!("{}.elapsed()", sugg.maybe_paren()),
127127
Applicability::MachineApplicable,
128128
);
129129
}

clippy_lints/src/len_zero.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl<'tcx> LateLintPass<'tcx> for LenZero {
180180
let mut applicability = Applicability::MachineApplicable;
181181

182182
let lit1 = peel_ref_operators(cx, lt.init);
183-
let lit_str = Sugg::hir_with_context(cx, lit1, lt.span.ctxt(), "_", &mut applicability).maybe_par();
183+
let lit_str = Sugg::hir_with_context(cx, lit1, lt.span.ctxt(), "_", &mut applicability).maybe_paren();
184184

185185
span_lint_and_sugg(
186186
cx,
@@ -573,7 +573,7 @@ fn check_empty_expr(cx: &LateContext<'_>, span: Span, lit1: &Expr<'_>, lit2: &Ex
573573
let mut applicability = Applicability::MachineApplicable;
574574

575575
let lit1 = peel_ref_operators(cx, lit1);
576-
let lit_str = Sugg::hir_with_context(cx, lit1, span.ctxt(), "_", &mut applicability).maybe_par();
576+
let lit_str = Sugg::hir_with_context(cx, lit1, span.ctxt(), "_", &mut applicability).maybe_paren();
577577

578578
span_lint_and_sugg(
579579
cx,

clippy_lints/src/loops/for_kv_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, pat: &'tcx Pat<'_>, arg: &'tcx
4545
"use the corresponding method",
4646
vec![
4747
(pat_span, snippet(cx, new_pat_span, kind).into_owned()),
48-
(arg_span, format!("{}.{kind}s{mutbl}()", map.maybe_par())),
48+
(arg_span, format!("{}.{kind}s{mutbl}()", map.maybe_paren())),
4949
],
5050
Applicability::MachineApplicable,
5151
);

clippy_lints/src/loops/manual_memcpy.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,12 @@ fn build_manual_memcpy_suggestion<'tcx>(
184184
{
185185
dst_base_str
186186
} else {
187-
format!("{dst_base_str}[{}..{}]", dst_offset.maybe_par(), dst_limit.maybe_par()).into()
187+
format!(
188+
"{dst_base_str}[{}..{}]",
189+
dst_offset.maybe_paren(),
190+
dst_limit.maybe_paren()
191+
)
192+
.into()
188193
};
189194

190195
let method_str = if is_copy(cx, elem_ty) {
@@ -196,7 +201,12 @@ fn build_manual_memcpy_suggestion<'tcx>(
196201
let src = if is_array_length_equal_to_range(cx, start, end, src.base) {
197202
src_base_str
198203
} else {
199-
format!("{src_base_str}[{}..{}]", src_offset.maybe_par(), src_limit.maybe_par()).into()
204+
format!(
205+
"{src_base_str}[{}..{}]",
206+
src_offset.maybe_paren(),
207+
src_limit.maybe_paren()
208+
)
209+
.into()
200210
};
201211

202212
format!("{dst}.{method_str}(&{src});")

clippy_lints/src/loops/utils.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ pub(super) fn make_iterator_snippet(cx: &LateContext<'_>, arg: &Expr<'_>, applic
263263
if impls_iterator {
264264
format!(
265265
"{}",
266-
sugg::Sugg::hir_with_applicability(cx, arg, "_", applic_ref).maybe_par()
266+
sugg::Sugg::hir_with_applicability(cx, arg, "_", applic_ref).maybe_paren()
267267
)
268268
} else {
269269
// (&x).into_iter() ==> x.iter()
@@ -281,12 +281,12 @@ pub(super) fn make_iterator_snippet(cx: &LateContext<'_>, arg: &Expr<'_>, applic
281281
};
282282
format!(
283283
"{}.{method_name}()",
284-
sugg::Sugg::hir_with_applicability(cx, caller, "_", applic_ref).maybe_par(),
284+
sugg::Sugg::hir_with_applicability(cx, caller, "_", applic_ref).maybe_paren(),
285285
)
286286
},
287287
_ => format!(
288288
"{}.into_iter()",
289-
sugg::Sugg::hir_with_applicability(cx, arg, "_", applic_ref).maybe_par()
289+
sugg::Sugg::hir_with_applicability(cx, arg, "_", applic_ref).maybe_paren()
290290
),
291291
}
292292
}

clippy_lints/src/manual_assert.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualAssert {
6060
ExprKind::Unary(UnOp::Not, e) => (e, ""),
6161
_ => (cond, "!"),
6262
};
63-
let cond_sugg = sugg::Sugg::hir_with_applicability(cx, cond, "..", &mut applicability).maybe_par();
63+
let cond_sugg = sugg::Sugg::hir_with_applicability(cx, cond, "..", &mut applicability).maybe_paren();
6464
let semicolon = if is_parent_stmt(cx, expr.hir_id) { ";" } else { "" };
6565
let sugg = format!("assert!({not}{cond_sugg}, {format_args_snip}){semicolon}");
6666
// we show to the user the suggestion without the comments, but when applying the fix, include the

clippy_lints/src/manual_clamp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ fn maybe_emit_suggestion<'tcx>(cx: &LateContext<'tcx>, suggestion: &ClampSuggest
181181
make_assignment,
182182
hir_with_ignore_attr,
183183
} = suggestion;
184-
let input = Sugg::hir(cx, input, "..").maybe_par();
184+
let input = Sugg::hir(cx, input, "..").maybe_paren();
185185
let min = Sugg::hir(cx, min, "..");
186186
let max = Sugg::hir(cx, max, "..");
187187
let semicolon = if make_assignment.is_some() { ";" } else { "" };

clippy_lints/src/manual_div_ceil.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ fn build_suggestion(
167167
rhs: &Expr<'_>,
168168
applicability: &mut Applicability,
169169
) {
170-
let dividend_sugg = Sugg::hir_with_applicability(cx, lhs, "..", applicability).maybe_par();
170+
let dividend_sugg = Sugg::hir_with_applicability(cx, lhs, "..", applicability).maybe_paren();
171171
let type_suffix = if cx.typeck_results().expr_ty(lhs).is_numeric()
172172
&& matches!(
173173
lhs.kind,

clippy_lints/src/manual_is_ascii_check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ fn check_is_ascii(
148148
};
149149
let default_snip = "..";
150150
let mut app = Applicability::MachineApplicable;
151-
let recv = Sugg::hir_with_context(cx, recv, span.ctxt(), default_snip, &mut app).maybe_par();
151+
let recv = Sugg::hir_with_context(cx, recv, span.ctxt(), default_snip, &mut app).maybe_paren();
152152
let mut suggestion = vec![(span, format!("{recv}.{sugg}()"))];
153153
if let Some((ty_span, ty)) = ty_sugg {
154154
suggestion.push((ty_span, format!("{recv}: {ty}")));

clippy_lints/src/manual_rotate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl LateLintPass<'_> for ManualRotate {
101101
(r_shift_dir, r_amount)
102102
};
103103
let mut applicability = Applicability::MachineApplicable;
104-
let expr_sugg = sugg::Sugg::hir_with_applicability(cx, l_expr, "_", &mut applicability).maybe_par();
104+
let expr_sugg = sugg::Sugg::hir_with_applicability(cx, l_expr, "_", &mut applicability).maybe_paren();
105105
span_lint_and_sugg(
106106
cx,
107107
MANUAL_ROTATE,

clippy_lints/src/manual_unwrap_or_default.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ fn handle<'tcx>(cx: &LateContext<'tcx>, if_let_or_match: IfLetOrMatch<'tcx>, exp
150150
// We now check the `None` arm is calling a method equivalent to `Default::default`.
151151
&& let body_none = peel_blocks(body_none)
152152
&& is_default_equivalent(cx, body_none)
153-
&& let Some(receiver) = Sugg::hir_opt(cx, condition).map(Sugg::maybe_par)
153+
&& let Some(receiver) = Sugg::hir_opt(cx, condition).map(Sugg::maybe_paren)
154154
{
155155
// Machine applicable only if there are no comments present
156156
let applicability = if span_contains_comment(cx.sess().source_map(), expr.span) {

0 commit comments

Comments
 (0)