From 2e61659bd1f3998520abc77f5459c529083a7a3d Mon Sep 17 00:00:00 2001 From: Roxane Date: Fri, 13 Aug 2021 20:48:59 -0400 Subject: [PATCH] Update comment and fix fmt --- compiler/rustc_typeck/src/expr_use_visitor.rs | 2 +- .../{match-multi-variant.rs => match-edge-cases.rs} | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) rename src/test/ui/closures/2229_closure_analysis/{match-multi-variant.rs => match-edge-cases.rs} (77%) diff --git a/compiler/rustc_typeck/src/expr_use_visitor.rs b/compiler/rustc_typeck/src/expr_use_visitor.rs index ac26380582a95..1bdad508daa2d 100644 --- a/compiler/rustc_typeck/src/expr_use_visitor.rs +++ b/compiler/rustc_typeck/src/expr_use_visitor.rs @@ -266,7 +266,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> { needs_to_be_read = true; } } else { - // If it is not ty::Adt, then it is a MultiVariant + // If it is not ty::Adt, then it should be read needs_to_be_read = true; } } diff --git a/src/test/ui/closures/2229_closure_analysis/match-multi-variant.rs b/src/test/ui/closures/2229_closure_analysis/match-edge-cases.rs similarity index 77% rename from src/test/ui/closures/2229_closure_analysis/match-multi-variant.rs rename to src/test/ui/closures/2229_closure_analysis/match-edge-cases.rs index 78ae5aff0abac..914ebbe26a57d 100644 --- a/src/test/ui/closures/2229_closure_analysis/match-multi-variant.rs +++ b/src/test/ui/closures/2229_closure_analysis/match-edge-cases.rs @@ -5,7 +5,7 @@ const PATTERN_REF: &str = "Hello World"; const NUMBER: i32 = 30; const NUMBER_POINTER: *const i32 = &NUMBER; -pub fn multi_variant_ref(event: &str) { +pub fn edge_case_ref(event: &str) { let _ = || { match event { PATTERN_REF => (), @@ -14,7 +14,7 @@ pub fn multi_variant_ref(event: &str) { }; } -pub fn multi_variant_str(event: String) { +pub fn edge_case_str(event: String) { let _ = || { match event.as_str() { "hello" => (), @@ -23,7 +23,7 @@ pub fn multi_variant_str(event: String) { }; } -pub fn multi_variant_raw_ptr(event: *const i32) { +pub fn edge_case_raw_ptr(event: *const i32) { let _ = || { match event { NUMBER_POINTER => (), @@ -32,7 +32,7 @@ pub fn multi_variant_raw_ptr(event: *const i32) { }; } -pub fn multi_variant_char(event: char) { +pub fn edge_case_char(event: char) { let _ = || { match event { 'a' => (),