about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-11-19 20:58:16 +0000
committerbors <bors@rust-lang.org>2023-11-19 20:58:16 +0000
commit9a66e4471f71283fd54d80ef8147630d34756332 (patch)
tree5dc489c7f92efe10824608139e0588be6dc29ea3 /src
parentd19980e1ce9cde530240ed9d42ab54bb79ce8b40 (diff)
parentac56b06b44c3aeb2d64c7ea6caf08973e4892637 (diff)
downloadrust-9a66e4471f71283fd54d80ef8147630d34756332.tar.gz
rust-9a66e4471f71283fd54d80ef8147630d34756332.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/tools/clippy/clippy_lints/src/booleans.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tools/clippy/clippy_lints/src/booleans.rs b/src/tools/clippy/clippy_lints/src/booleans.rs
index d4f2e316890..2cb599964d2 100644
--- a/src/tools/clippy/clippy_lints/src/booleans.rs
+++ b/src/tools/clippy/clippy_lints/src/booleans.rs
@@ -424,8 +424,9 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
                     improvements.push(suggestion);
                 }
             }
-            let nonminimal_bool_lint = |suggestions: Vec<_>| {
+            let nonminimal_bool_lint = |mut suggestions: Vec<_>| {
                 if self.cx.tcx.lint_level_at_node(NONMINIMAL_BOOL, e.hir_id).0 != Level::Allow {
+                    suggestions.sort();
                     span_lint_hir_and_then(
                         self.cx,
                         NONMINIMAL_BOOL,