about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2025-06-18 18:06:51 +0200
committerGitHub <noreply@github.com>2025-06-18 18:06:51 +0200
commit2c4e0a91693f2fbe9693f19c292c05e5d55dc4ee (patch)
treee52195e65b00276d2a2fc8d2564a17d3bfd62475 /compiler/rustc_trait_selection/src
parentec295ad59c3e23fb68af78dc7fbf112614173545 (diff)
parent8c83935cdf87d4e3c0d9e7796fc810fb54ecbf39 (diff)
downloadrust-2c4e0a91693f2fbe9693f19c292c05e5d55dc4ee.tar.gz
rust-2c4e0a91693f2fbe9693f19c292c05e5d55dc4ee.zip
Rollup merge of #142619 - klensy:or_fun_call, r=nnethercote
apply clippy::or_fun_call

Applies https://rust-lang.github.io/rust-clippy/master/index.html?groups=nursery#or_fun_call to reduce needless allocs.
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/error_reporting/infer/region.rs2
-rw-r--r--compiler/rustc_trait_selection/src/traits/normalize.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs
index b8207c4f816..5c669678ccc 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs
@@ -891,7 +891,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
             (b'a'..=b'z')
                 .map(|c| format!("'{}", c as char))
                 .find(|candidate| !used_names.iter().any(|e| e.as_str() == candidate))
-                .unwrap_or("'lt".to_string())
+                .unwrap_or_else(|| "'lt".to_string())
         };
 
         let mut visitor = LifetimeReplaceVisitor {
diff --git a/compiler/rustc_trait_selection/src/traits/normalize.rs b/compiler/rustc_trait_selection/src/traits/normalize.rs
index 35a43b294ee..9e02ce32b21 100644
--- a/compiler/rustc_trait_selection/src/traits/normalize.rs
+++ b/compiler/rustc_trait_selection/src/traits/normalize.rs
@@ -224,7 +224,7 @@ impl<'a, 'b, 'tcx> AssocTypeNormalizer<'a, 'b, 'tcx> {
             )
             .ok()
             .flatten()
-            .unwrap_or(proj.to_term(infcx.tcx));
+            .unwrap_or_else(|| proj.to_term(infcx.tcx));
 
             PlaceholderReplacer::replace_placeholders(
                 infcx,