mirror of
https://github.com/dlang-community/D-Scanner.git
synced 2025-05-13 22:35:58 +03:00
Run dfmt
This commit is contained in:
parent
2ec0259260
commit
1c96fddeb5
46 changed files with 540 additions and 499 deletions
|
@ -11,7 +11,9 @@ import analysis.base;
|
|||
import std.algorithm : canFind;
|
||||
import dsymbol.scope_ : Scope;
|
||||
|
||||
void doNothing(string, size_t, size_t, string, bool) {}
|
||||
void doNothing(string, size_t, size_t, string, bool)
|
||||
{
|
||||
}
|
||||
|
||||
class EnumArrayLiteralCheck : BaseAnalyzer
|
||||
{
|
||||
|
@ -35,17 +37,19 @@ class EnumArrayLiteralCheck : BaseAnalyzer
|
|||
{
|
||||
foreach (i, initializer; autoDec.initializers)
|
||||
{
|
||||
if (initializer is null) continue;
|
||||
if (initializer.nonVoidInitializer is null) continue;
|
||||
if (initializer.nonVoidInitializer.arrayInitializer is null) continue;
|
||||
addErrorMessage(autoDec.identifiers[i].line,
|
||||
autoDec.identifiers[i].column, "dscanner.performance.enum_array_literal",
|
||||
"This enum may lead to unnecessary allocation at run-time."
|
||||
~ " Use 'static immutable " ~ autoDec.identifiers[i].text
|
||||
~ " = [ ...' instead.");
|
||||
if (initializer is null)
|
||||
continue;
|
||||
if (initializer.nonVoidInitializer is null)
|
||||
continue;
|
||||
if (initializer.nonVoidInitializer.arrayInitializer is null)
|
||||
continue;
|
||||
addErrorMessage(autoDec.identifiers[i].line, autoDec.identifiers[i].column,
|
||||
"dscanner.performance.enum_array_literal",
|
||||
"This enum may lead to unnecessary allocation at run-time."
|
||||
~ " Use 'static immutable "
|
||||
~ autoDec.identifiers[i].text ~ " = [ ...' instead.");
|
||||
}
|
||||
}
|
||||
autoDec.accept(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue