diff options
| author | bors <bors@rust-lang.org> | 2022-05-08 15:00:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-08 15:00:30 +0000 |
| commit | 4667198d4f6a0fd4c2cccd0ddec4e5afbe291401 (patch) | |
| tree | e0deb4a19ca2bee054e23f3dc52fb922b5acc62b /clippy_lints/src/mem_replace.rs | |
| parent | 9c78883fdf5ccdeef833bc99095a18dcf6312d0b (diff) | |
| parent | 597f61bbe3a861c3d77b784cc701e6a975fbe842 (diff) | |
Auto merge of #8802 - smoelius:allow-expect-unwrap-in-tests, r=llogiq
Optionally allow `expect` and `unwrap` in tests This addresses #1015, except it makes the new behavior optional. The reason for the msrv-related changes is as follows. Rather than expand `check_methods` list of arguments, it seemed easier to make `check_methods` a method of `Methods`, so that `check_methods` could access `Methods`' fields. `check_methods` had an `msrv` parameter, which I consequently made a field of `Methods`. But, to avoid adding a lifetime parameter to `Methods`, I made the field type `Option<RustcVersion>` instead of the parameter's existing type, `Option<&RustcVersion>`. This seemed sensible since `RustcVersion` implements `Copy`. But this broke a lot of code that expected an `Option<&RustcVersion>` or `&Option<RustcVersion>`. I changed all of those occurrences to `Option<RustcVersion>`. IMHO, the code is better as a result of these changes, though. The msrv-related changes are in their own commit to (hopefully) ease review. Closes #1015 changelog: optionally allow `expect` and `unwrap` in tests r? `@llogiq`
Diffstat (limited to 'clippy_lints/src/mem_replace.rs')
| -rw-r--r-- | clippy_lints/src/mem_replace.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/mem_replace.rs b/clippy_lints/src/mem_replace.rs index 054937e3e36..41073d40f3d 100644 --- a/clippy_lints/src/mem_replace.rs +++ b/clippy_lints/src/mem_replace.rs @@ -254,7 +254,7 @@ impl<'tcx> LateLintPass<'tcx> for MemReplace { then { check_replace_option_with_none(cx, src, dest, expr.span); check_replace_with_uninit(cx, src, dest, expr.span); - if meets_msrv(self.msrv.as_ref(), &msrvs::MEM_TAKE) { + if meets_msrv(self.msrv, msrvs::MEM_TAKE) { check_replace_with_default(cx, src, dest, expr.span); } } |
