From 9342574097d797d62f003f495c5dd13fb148758c Mon Sep 17 00:00:00 2001 From: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> Date: Sun, 21 Jun 2020 18:47:27 +0200 Subject: do not suggest assist for return type to result in bad case #4826 Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> --- crates/ra_assists/src/handlers/change_return_type_to_result.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crates/ra_assists') 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::{ }; use crate::{AssistContext, AssistId, Assists}; +use test_utils::mark; // Assist: change_return_type_to_result // @@ -26,6 +27,7 @@ pub(crate) fn change_return_type_to_result(acc: &mut Assists, ctx: &AssistContex let first_part_ret_type = ret_type_str.splitn(2, '<').next(); if let Some(ret_type_first_part) = first_part_ret_type { if ret_type_first_part.ends_with("Result") { + mark::hit!(change_return_type_to_result_simple_return_type_already_result); return None; } } @@ -313,6 +315,7 @@ mod tests { #[test] fn change_return_type_to_result_simple_return_type_already_result() { + mark::check!(change_return_type_to_result_simple_return_type_already_result); check_assist_not_applicable( change_return_type_to_result, r#"fn foo() -> Result, String> { -- cgit v1.2.3