diff options
| author | bors <bors@rust-lang.org> | 2020-09-16 19:36:49 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-09-16 19:36:49 +0000 |
| commit | 06f190287848ceeee36be738cbbd8e008f3e7615 (patch) | |
| tree | 1ffbb1c3496912d6c44c85165feac3afd470ecb8 /clippy_lints/src/utils/sugg.rs | |
| parent | 44d6439bfdcdd33435ca402ae1b04e1c0d6eb6ab (diff) | |
| parent | 79da7474b160e2230467f84ff0df3a23658eb4a6 (diff) | |
Auto merge of #5937 - montrivo:option_if_let_else, r=flip1995
option_if_let_else - distinguish pure from impure else expressions Addresses partially #5821. changelog: improve the lint `option_if_let_else`. Suggest `map_or` or `map_or_else` based on the else expression purity.
Diffstat (limited to 'clippy_lints/src/utils/sugg.rs')
| -rw-r--r-- | clippy_lints/src/utils/sugg.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_lints/src/utils/sugg.rs b/clippy_lints/src/utils/sugg.rs index 811fde388d1..ec8b7e59b59 100644 --- a/clippy_lints/src/utils/sugg.rs +++ b/clippy_lints/src/utils/sugg.rs @@ -49,7 +49,7 @@ impl<'a> Sugg<'a> { /// Convenience function around `hir_opt` for suggestions with a default /// text. pub fn hir(cx: &LateContext<'_>, expr: &hir::Expr<'_>, default: &'a str) -> Self { - Self::hir_opt(cx, expr).unwrap_or_else(|| Sugg::NonParen(Cow::Borrowed(default))) + Self::hir_opt(cx, expr).unwrap_or(Sugg::NonParen(Cow::Borrowed(default))) } /// Same as `hir`, but it adapts the applicability level by following rules: |
