aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-06-21 17:47:27 +0100
committerBenjamin Coenen <[email protected]>2020-06-21 17:47:27 +0100
commit9342574097d797d62f003f495c5dd13fb148758c (patch)
tree4cca8694b7753624a8546749b89fa58e126375c0 /crates
parent4c89d32f7a7842fa58ed4460c0f455b5fda8f47b (diff)
do not suggest assist for return type to result in bad case #4826
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/handlers/change_return_type_to_result.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_assists/src/handlers/change_return_type_to_result.rs b/crates/ra_assists/src/handlers/change_return_type_to_result.rs
index 12572936a..855baf187 100644
--- a/crates/ra_assists/src/handlers/change_return_type_to_result.rs
+++ b/crates/ra_assists/src/handlers/change_return_type_to_result.rs
@@ -4,6 +4,7 @@ use ra_syntax::{
4}; 4};
5 5
6use crate::{AssistContext, AssistId, Assists}; 6use crate::{AssistContext, AssistId, Assists};
7use test_utils::mark;
7 8
8// Assist: change_return_type_to_result 9// Assist: change_return_type_to_result
9// 10//
@@ -26,6 +27,7 @@ pub(crate) fn change_return_type_to_result(acc: &mut Assists, ctx: &AssistContex
26 let first_part_ret_type = ret_type_str.splitn(2, '<').next(); 27 let first_part_ret_type = ret_type_str.splitn(2, '<').next();
27 if let Some(ret_type_first_part) = first_part_ret_type { 28 if let Some(ret_type_first_part) = first_part_ret_type {
28 if ret_type_first_part.ends_with("Result") { 29 if ret_type_first_part.ends_with("Result") {
30 mark::hit!(change_return_type_to_result_simple_return_type_already_result);
29 return None; 31 return None;
30 } 32 }
31 } 33 }
@@ -313,6 +315,7 @@ mod tests {
313 315
314 #[test] 316 #[test]
315 fn change_return_type_to_result_simple_return_type_already_result() { 317 fn change_return_type_to_result_simple_return_type_already_result() {
318 mark::check!(change_return_type_to_result_simple_return_type_already_result);
316 check_assist_not_applicable( 319 check_assist_not_applicable(
317 change_return_type_to_result, 320 change_return_type_to_result,
318 r#"fn foo() -> Result<i32<|>, String> { 321 r#"fn foo() -> Result<i32<|>, String> {