diff options
author | Aleksey Kladov <[email protected]> | 2021-06-18 21:28:37 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-06-18 21:28:37 +0100 |
commit | 181184a350046a460441209fd34821c2c796b066 (patch) | |
tree | 14e572eacf0feffd45250156c373d0148b78ee93 /crates/ide_assists/src/handlers/replace_unwrap_with_match.rs | |
parent | 89a0e58393de0ae39fc1f33a33cec87bc084a9f1 (diff) |
minor: use minicore
Diffstat (limited to 'crates/ide_assists/src/handlers/replace_unwrap_with_match.rs')
-rw-r--r-- | crates/ide_assists/src/handlers/replace_unwrap_with_match.rs | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/crates/ide_assists/src/handlers/replace_unwrap_with_match.rs b/crates/ide_assists/src/handlers/replace_unwrap_with_match.rs index a3bfa221c..7e57353c6 100644 --- a/crates/ide_assists/src/handlers/replace_unwrap_with_match.rs +++ b/crates/ide_assists/src/handlers/replace_unwrap_with_match.rs | |||
@@ -97,25 +97,24 @@ mod tests { | |||
97 | fn test_replace_result_unwrap_with_match() { | 97 | fn test_replace_result_unwrap_with_match() { |
98 | check_assist( | 98 | check_assist( |
99 | replace_unwrap_with_match, | 99 | replace_unwrap_with_match, |
100 | r" | 100 | r#" |
101 | enum Result<T, E> { Ok(T), Err(E) } | 101 | //- minicore: result |
102 | fn i<T>(a: T) -> T { a } | 102 | fn i<T>(a: T) -> T { a } |
103 | fn main() { | 103 | fn main() { |
104 | let x: Result<i32, i32> = Result::Ok(92); | 104 | let x: Result<i32, i32> = Ok(92); |
105 | let y = i(x).$0unwrap(); | 105 | let y = i(x).$0unwrap(); |
106 | } | 106 | } |
107 | ", | 107 | "#, |
108 | r" | 108 | r#" |
109 | enum Result<T, E> { Ok(T), Err(E) } | ||
110 | fn i<T>(a: T) -> T { a } | 109 | fn i<T>(a: T) -> T { a } |
111 | fn main() { | 110 | fn main() { |
112 | let x: Result<i32, i32> = Result::Ok(92); | 111 | let x: Result<i32, i32> = Ok(92); |
113 | let y = match i(x) { | 112 | let y = match i(x) { |
114 | Ok(it) => it, | 113 | Ok(it) => it, |
115 | $0_ => unreachable!(), | 114 | $0_ => unreachable!(), |
116 | }; | 115 | }; |
117 | } | 116 | } |
118 | ", | 117 | "#, |
119 | ) | 118 | ) |
120 | } | 119 | } |
121 | 120 | ||
@@ -123,25 +122,24 @@ fn main() { | |||
123 | fn test_replace_option_unwrap_with_match() { | 122 | fn test_replace_option_unwrap_with_match() { |
124 | check_assist( | 123 | check_assist( |
125 | replace_unwrap_with_match, | 124 | replace_unwrap_with_match, |
126 | r" | 125 | r#" |
127 | enum Option<T> { Some(T), None } | 126 | //- minicore: option |
128 | fn i<T>(a: T) -> T { a } | 127 | fn i<T>(a: T) -> T { a } |
129 | fn main() { | 128 | fn main() { |
130 | let x = Option::Some(92); | 129 | let x = Some(92); |
131 | let y = i(x).$0unwrap(); | 130 | let y = i(x).$0unwrap(); |
132 | } | 131 | } |
133 | ", | 132 | "#, |
134 | r" | 133 | r#" |
135 | enum Option<T> { Some(T), None } | ||
136 | fn i<T>(a: T) -> T { a } | 134 | fn i<T>(a: T) -> T { a } |
137 | fn main() { | 135 | fn main() { |
138 | let x = Option::Some(92); | 136 | let x = Some(92); |
139 | let y = match i(x) { | 137 | let y = match i(x) { |
140 | Some(it) => it, | 138 | Some(it) => it, |
141 | $0_ => unreachable!(), | 139 | $0_ => unreachable!(), |
142 | }; | 140 | }; |
143 | } | 141 | } |
144 | ", | 142 | "#, |
145 | ); | 143 | ); |
146 | } | 144 | } |
147 | 145 | ||
@@ -149,25 +147,24 @@ fn main() { | |||
149 | fn test_replace_result_unwrap_with_match_chaining() { | 147 | fn test_replace_result_unwrap_with_match_chaining() { |
150 | check_assist( | 148 | check_assist( |
151 | replace_unwrap_with_match, | 149 | replace_unwrap_with_match, |
152 | r" | 150 | r#" |
153 | enum Result<T, E> { Ok(T), Err(E) } | 151 | //- minicore: result |
154 | fn i<T>(a: T) -> T { a } | 152 | fn i<T>(a: T) -> T { a } |
155 | fn main() { | 153 | fn main() { |
156 | let x: Result<i32, i32> = Result::Ok(92); | 154 | let x: Result<i32, i32> = Ok(92); |
157 | let y = i(x).$0unwrap().count_zeroes(); | 155 | let y = i(x).$0unwrap().count_zeroes(); |
158 | } | 156 | } |
159 | ", | 157 | "#, |
160 | r" | 158 | r#" |
161 | enum Result<T, E> { Ok(T), Err(E) } | ||
162 | fn i<T>(a: T) -> T { a } | 159 | fn i<T>(a: T) -> T { a } |
163 | fn main() { | 160 | fn main() { |
164 | let x: Result<i32, i32> = Result::Ok(92); | 161 | let x: Result<i32, i32> = Ok(92); |
165 | let y = match i(x) { | 162 | let y = match i(x) { |
166 | Ok(it) => it, | 163 | Ok(it) => it, |
167 | $0_ => unreachable!(), | 164 | $0_ => unreachable!(), |
168 | }.count_zeroes(); | 165 | }.count_zeroes(); |
169 | } | 166 | } |
170 | ", | 167 | "#, |
171 | ) | 168 | ) |
172 | } | 169 | } |
173 | 170 | ||
@@ -175,14 +172,14 @@ fn main() { | |||
175 | fn replace_unwrap_with_match_target() { | 172 | fn replace_unwrap_with_match_target() { |
176 | check_assist_target( | 173 | check_assist_target( |
177 | replace_unwrap_with_match, | 174 | replace_unwrap_with_match, |
178 | r" | 175 | r#" |
179 | enum Option<T> { Some(T), None } | 176 | //- minicore: option |
180 | fn i<T>(a: T) -> T { a } | 177 | fn i<T>(a: T) -> T { a } |
181 | fn main() { | 178 | fn main() { |
182 | let x = Option::Some(92); | 179 | let x = Some(92); |
183 | let y = i(x).$0unwrap(); | 180 | let y = i(x).$0unwrap(); |
184 | } | 181 | } |
185 | ", | 182 | "#, |
186 | r"i(x).unwrap()", | 183 | r"i(x).unwrap()", |
187 | ); | 184 | ); |
188 | } | 185 | } |