From 1ebfa908d50a7ef4765d2abb432531d9c98cbb58 Mon Sep 17 00:00:00 2001 From: bravomikekilo Date: Fri, 22 Nov 2019 03:18:22 +0800 Subject: fix tidy test --- crates/ra_assists/src/assists/invert_if.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'crates') diff --git a/crates/ra_assists/src/assists/invert_if.rs b/crates/ra_assists/src/assists/invert_if.rs index 9a53a3d18..c2c8529fe 100644 --- a/crates/ra_assists/src/assists/invert_if.rs +++ b/crates/ra_assists/src/assists/invert_if.rs @@ -2,8 +2,8 @@ use hir::db::HirDatabase; use ra_syntax::ast::{self, AstNode}; use ra_syntax::{TextRange, TextUnit}; -use crate::{Assist, AssistCtx, AssistId}; use super::apply_demorgan::undo_negation; +use crate::{Assist, AssistCtx, AssistId}; // Assist: invert_if // @@ -24,7 +24,6 @@ use super::apply_demorgan::undo_negation; // } // ``` - pub(crate) fn invert_if(ctx: AssistCtx) -> Option { let expr = ctx.find_node_at_offset::()?; let expr_range = expr.syntax().text_range(); @@ -49,12 +48,9 @@ pub(crate) fn invert_if(ctx: AssistCtx) -> Option { edit.replace(else_range, then_node.text()); edit.replace(then_range, else_node.text()); }) - } else { None } - - } #[cfg(test)] @@ -65,12 +61,20 @@ mod tests { #[test] fn invert_if_remove_inequality() { - check_assist(invert_if, "fn f() { i<|>f x != 3 {1} else {3 + 2} }", "fn f() { i<|>f x == 3 {3 + 2} else {1} }") + check_assist( + invert_if, + "fn f() { i<|>f x != 3 {1} else {3 + 2} }", + "fn f() { i<|>f x == 3 {3 + 2} else {1} }", + ) } #[test] fn invert_if_remove_not() { - check_assist(invert_if, "fn f() { <|>if !cond {3 * 2} else {1} }", "fn f() { <|>if cond {1} else {3 * 2} }") + check_assist( + invert_if, + "fn f() { <|>if !cond {3 * 2} else {1} }", + "fn f() { <|>if cond {1} else {3 * 2} }", + ) } #[test] -- cgit v1.2.3