diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2025-06-18 18:06:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-18 18:06:51 +0200 |
| commit | 2c4e0a91693f2fbe9693f19c292c05e5d55dc4ee (patch) | |
| tree | e52195e65b00276d2a2fc8d2564a17d3bfd62475 /compiler/rustc_trait_selection/src | |
| parent | ec295ad59c3e23fb68af78dc7fbf112614173545 (diff) | |
| parent | 8c83935cdf87d4e3c0d9e7796fc810fb54ecbf39 (diff) | |
| download | rust-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.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/normalize.rs | 2 |
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, |
