diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-05-11 19:08:26 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-11 19:08:26 +0100 |
commit | 0063ad970dd8d25ce2e420f2a419fbcd8b6c6f77 (patch) | |
tree | 1e4da49b53a9584eaaa3d166bab29f61d03c606d /crates/ra_assists | |
parent | 848aa56df5229d13b92987d631f318c87bffbc96 (diff) | |
parent | 92b2230fefe61322dbca8194c8721f848c5d1c2f (diff) |
Merge #4358
4358: add if let and while let postfix for Option and Result #4348 r=matklad a=bnjjj
close #4348
I also added `while let` for iterator or stream it could be useful
![iflet](https://user-images.githubusercontent.com/5719034/81278000-676c6b80-9055-11ea-87ad-6b8476dd983f.gif)
Co-authored-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/ra_assists')
-rw-r--r-- | crates/ra_assists/src/utils.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs index 2f15a3f15..f3fc92ebf 100644 --- a/crates/ra_assists/src/utils.rs +++ b/crates/ra_assists/src/utils.rs | |||
@@ -103,7 +103,7 @@ fn invert_special_case(expr: &ast::Expr) -> Option<ast::Expr> { | |||
103 | } | 103 | } |
104 | 104 | ||
105 | #[derive(Clone, Copy)] | 105 | #[derive(Clone, Copy)] |
106 | pub(crate) enum TryEnum { | 106 | pub enum TryEnum { |
107 | Result, | 107 | Result, |
108 | Option, | 108 | Option, |
109 | } | 109 | } |
@@ -111,7 +111,7 @@ pub(crate) enum TryEnum { | |||
111 | impl TryEnum { | 111 | impl TryEnum { |
112 | const ALL: [TryEnum; 2] = [TryEnum::Option, TryEnum::Result]; | 112 | const ALL: [TryEnum; 2] = [TryEnum::Option, TryEnum::Result]; |
113 | 113 | ||
114 | pub(crate) fn from_ty(sema: &Semantics<RootDatabase>, ty: &Type) -> Option<TryEnum> { | 114 | pub fn from_ty(sema: &Semantics<RootDatabase>, ty: &Type) -> Option<TryEnum> { |
115 | let enum_ = match ty.as_adt() { | 115 | let enum_ = match ty.as_adt() { |
116 | Some(Adt::Enum(it)) => it, | 116 | Some(Adt::Enum(it)) => it, |
117 | _ => return None, | 117 | _ => return None, |