From 1c89a01f33ebea40697b955a64c43c99f80b9c47 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Fri, 16 Dec 2016 00:52:17 +0100 Subject: [PATCH] Address @BBasile's review --- src/analysis/explicitly_annotated_unittests.d | 45 +++++-------------- 1 file changed, 11 insertions(+), 34 deletions(-) diff --git a/src/analysis/explicitly_annotated_unittests.d b/src/analysis/explicitly_annotated_unittests.d index 2911e26..1fde833 100644 --- a/src/analysis/explicitly_annotated_unittests.d +++ b/src/analysis/explicitly_annotated_unittests.d @@ -28,13 +28,13 @@ class ExplicitlyAnnotatedUnittestCheck : BaseAnalyzer { if (decl.unittest_ !is null) { - bool isSafeOrSystem = false; + bool isSafeOrSystem; if (decl.attributes !is null) foreach (attribute; decl.attributes) { if (attribute.atAttribute !is null) { - auto token = attribute.atAttribute.identifier.text; + const token = attribute.atAttribute.identifier.text; if (token == "safe" || token == "system") { isSafeOrSystem = true; @@ -63,25 +63,12 @@ unittest sac.explicitly_annotated_unittests = Check.enabled; assertAnalyzerWarnings(q{ - @safe unittest { + @safe unittest {} + @system unittest {} + pure nothrow @system @nogc unittest {} - } - - @system unittest { - - } - - pure nothrow @system @nogc unittest { - - } - - unittest // [warn]: %s - { - - } - pure nothrow @nogc unittest // [warn]: %s - { - } + unittest {} // [warn]: %s + pure nothrow @nogc unittest {} // [warn]: %s }c.format( ExplicitlyAnnotatedUnittestCheck.MESSAGE, ExplicitlyAnnotatedUnittestCheck.MESSAGE, @@ -91,21 +78,11 @@ unittest assertAnalyzerWarnings(q{ struct Foo { - @safe unittest { + @safe unittest {} + @system unittest {} - } - - @system unittest { - - } - - unittest // [warn]: %s - { - - } - pure nothrow @nogc unittest // [warn]: %s - { - } + unittest {} // [warn]: %s + pure nothrow @nogc unittest {} // [warn]: %s } }c.format( ExplicitlyAnnotatedUnittestCheck.MESSAGE,