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_utils/src/lib.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_utils/src/lib.rs')
| -rw-r--r-- | clippy_utils/src/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index 7d46952d971..ed511004ea0 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -117,8 +117,8 @@ pub fn parse_msrv(msrv: &str, sess: Option<&Session>, span: Option<Span>) -> Opt None } -pub fn meets_msrv(msrv: Option<&RustcVersion>, lint_msrv: &RustcVersion) -> bool { - msrv.map_or(true, |msrv| msrv.meets(*lint_msrv)) +pub fn meets_msrv(msrv: Option<RustcVersion>, lint_msrv: RustcVersion) -> bool { + msrv.map_or(true, |msrv| msrv.meets(lint_msrv)) } #[macro_export] |
