summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-02-23 19:56:35 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2024-02-23 19:56:35 +0100
commit86a7fc840f11cd1f20fdf26d3071e34a2d4bc313 (patch)
tree825af3e5f80cc4cb41aca59fe20467a382b2ae22 /compiler/rustc_trait_selection/src/traits
parentb6a23b853719c8c22c022993c9eb2871b09fc2b9 (diff)
downloadrust-86a7fc840f11cd1f20fdf26d3071e34a2d4bc313.tar.gz
rust-86a7fc840f11cd1f20fdf26d3071e34a2d4bc313.zip
compiler: clippy::complexity fixes
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits')
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs24
-rw-r--r--compiler/rustc_trait_selection/src/traits/project.rs7
2 files changed, 14 insertions, 17 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
index 8ae31392b40..85f6da0d6cc 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -1283,9 +1283,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
                             "the full type name has been written to '{}'",
                             file.display()
                         ));
-                        err.note(format!(
-                            "consider using `--verbose` to print full type name to the console"
-                        ));
+                        err.note(
+                            "consider using `--verbose` to print full type name to the console",
+                        );
                     }
 
                     if imm_ref_self_ty_satisfies_pred && mut_ref_self_ty_satisfies_pred {
@@ -2869,9 +2869,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
                         "the full name for the type has been written to '{}'",
                         file.display(),
                     ));
-                    err.note(format!(
-                        "consider using `--verbose` to print the full type name to the console"
-                    ));
+                    err.note(
+                        "consider using `--verbose` to print the full type name to the console",
+                    );
                 }
             }
             ObligationCauseCode::RepeatElementCopy {
@@ -3339,9 +3339,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
                         "the full type name has been written to '{}'",
                         file.display(),
                     ));
-                    err.note(format!(
-                        "consider using `--verbose` to print the full type name to the console"
-                    ));
+                    err.note(
+                        "consider using `--verbose` to print the full type name to the console",
+                    );
                 }
                 let mut parent_predicate = parent_trait_pred;
                 let mut data = &data.derived;
@@ -3395,9 +3395,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
                             "the full type name has been written to '{}'",
                             file.display(),
                         ));
-                        err.note(format!(
-                            "consider using `--verbose` to print the full type name to the console"
-                        ));
+                        err.note(
+                            "consider using `--verbose` to print the full type name to the console",
+                        );
                     }
                 }
                 // #74711: avoid a stack overflow
diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs
index f8de19043e1..68c03e3c73e 100644
--- a/compiler/rustc_trait_selection/src/traits/project.rs
+++ b/compiler/rustc_trait_selection/src/traits/project.rs
@@ -1031,12 +1031,9 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
                     {
                         candidate_set.mark_ambiguous();
                         true
-                    } else if obligation.predicate.args.type_at(0).to_opt_closure_kind().is_some()
-                        && obligation.predicate.args.type_at(1).to_opt_closure_kind().is_some()
-                    {
-                        true
                     } else {
-                        false
+                        obligation.predicate.args.type_at(0).to_opt_closure_kind().is_some()
+                        && obligation.predicate.args.type_at(1).to_opt_closure_kind().is_some()
                     }
                 } else if lang_items.discriminant_kind_trait() == Some(trait_ref.def_id) {
                     match self_ty.kind() {