Skip to content

Commit 6e176b5

Browse files
committed
Auto merge of #117683 - estebank:priv-builder-sugg, r=cjgillot
When encountering struct fn call literal with private fields, suggest all builders When encountering code like `Box(42)`, suggest `Box::new(42)` and *all* other associated functions that return `-> Box<T>`. Add a way to give pre-sorted suggestions.
2 parents 538d1ae + a1854b1 commit 6e176b5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clippy_lints/src/booleans.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,9 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
424424
improvements.push(suggestion);
425425
}
426426
}
427-
let nonminimal_bool_lint = |suggestions: Vec<_>| {
427+
let nonminimal_bool_lint = |mut suggestions: Vec<_>| {
428428
if self.cx.tcx.lint_level_at_node(NONMINIMAL_BOOL, e.hir_id).0 != Level::Allow {
429+
suggestions.sort();
429430
span_lint_hir_and_then(
430431
self.cx,
431432
NONMINIMAL_BOOL,

0 commit comments

Comments
 (0)