@@ -3,9 +3,9 @@ use crate::utils::paths;
3
3
use crate :: utils:: sugg:: Sugg ;
4
4
use crate :: utils:: usage:: is_unused;
5
5
use crate :: utils:: {
6
- span_lint_and_help , span_lint_and_note ,
7
- expr_block , in_macro , is_allowed , is_expn_of , is_wild , match_qpath , match_type , multispan_sugg , remove_blocks ,
8
- snippet , snippet_block , snippet_with_applicability , span_lint_and_sugg, span_lint_and_then,
6
+ expr_block , get_arg_name , in_macro , is_allowed , is_expn_of , is_refutable , is_wild , match_qpath , match_type ,
7
+ match_var , multispan_sugg , remove_blocks , snippet , snippet_block , snippet_with_applicability , span_lint_and_help ,
8
+ span_lint_and_note , span_lint_and_sugg, span_lint_and_then, walk_ptrs_ty ,
9
9
} ;
10
10
use if_chain:: if_chain;
11
11
use rustc:: lint:: in_external_macro;
@@ -828,15 +828,16 @@ fn check_match_single_binding(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[A
828
828
let matched_vars = ex. span ;
829
829
let bind_names = arms[ 0 ] . pat . span ;
830
830
let match_body = remove_blocks ( & arms[ 0 ] . body ) ;
831
- let mut snippet_body = snippet_block ( cx , match_body. span , ".." ) . to_owned ( ) . to_string ( ) ;
832
- if match_body. span . from_expansion ( ) {
833
- snippet_body = Sugg :: hir_with_macro_callsite ( cx , match_body , ".." ) . to_string ( ) ;
834
- }
835
- // Do we need to add ';' to suggestion ?
831
+ let mut snippet_body = if match_body. span . from_expansion ( ) {
832
+ Sugg :: hir_with_macro_callsite ( cx , match_body, ".." ) . to_string ( )
833
+ } else {
834
+ snippet_block ( cx , match_body . span , ".." ) . to_owned ( ) . to_string ( )
835
+ } ;
836
836
if let ExprKind :: Block ( block, _) = & arms[ 0 ] . body . kind {
837
+ // Do we need to add ';' to suggestion ?
837
838
if block. stmts . len ( ) == 1 {
838
839
if let StmtKind :: Semi ( _) = block. stmts . get ( 0 ) . unwrap ( ) . kind {
839
- if !snippet_body. starts_with ( "{" ) && !snippet_body. ends_with ( "}" ) {
840
+ if !snippet_body. starts_with ( '{' ) && !snippet_body. ends_with ( '}' ) {
840
841
snippet_body. push ( ';' ) ;
841
842
}
842
843
}
0 commit comments