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 /src | |
| parent | ec295ad59c3e23fb68af78dc7fbf112614173545 (diff) | |
| parent | 8c83935cdf87d4e3c0d9e7796fc810fb54ecbf39 (diff) | |
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 'src')
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 3 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest/coverage.rs | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 75f24adb70f..e9b8b6bda3f 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2368,7 +2368,8 @@ impl<'test> TestCx<'test> { // Real paths into the libstd/libcore let rust_src_dir = &self.config.sysroot_base.join("lib/rustlib/src/rust"); rust_src_dir.try_exists().expect(&*format!("{} should exists", rust_src_dir)); - let rust_src_dir = rust_src_dir.read_link_utf8().unwrap_or(rust_src_dir.to_path_buf()); + let rust_src_dir = + rust_src_dir.read_link_utf8().unwrap_or_else(|_| rust_src_dir.to_path_buf()); normalize_path(&rust_src_dir.join("library"), "$SRC_DIR_REAL"); // eg. diff --git a/src/tools/compiletest/src/runtest/coverage.rs b/src/tools/compiletest/src/runtest/coverage.rs index 41cfeaee35f..38f0e956474 100644 --- a/src/tools/compiletest/src/runtest/coverage.rs +++ b/src/tools/compiletest/src/runtest/coverage.rs @@ -357,9 +357,9 @@ impl<'test> TestCx<'test> { // Add this line to the current subview. subviews .last_mut() - .ok_or(format!( - "unexpected subview line outside of a subview on line {line_num}" - ))? + .ok_or_else(|| { + format!("unexpected subview line outside of a subview on line {line_num}") + })? .push(line); } else { // This line is not part of a subview, so sort and print any |
