51 lines
937 B
Plaintext
51 lines
937 B
Plaintext
include::../rationale.adoc[]
|
|
|
|
include::../how-to-fix-it.adoc[]
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,dart,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
int numberOfMinutes(int hours) {
|
|
int seconds = 0; // Noncompliant: seconds is unused
|
|
return hours * 60;
|
|
}
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,dart,diff-id=1,diff-type=compliant]
|
|
----
|
|
int numberOfMinutes(int hours) {
|
|
return hours * 60;
|
|
}
|
|
----
|
|
|
|
== Resources
|
|
|
|
* Dart Docs - https://dart.dev/tools/diagnostic-messages#unused_local_variable[Dart Compiler diagnostic - unused_local_variable]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
* The value of the local variable '<variableName>' isn't used.
|
|
|
|
=== Highlighting
|
|
|
|
The identifier of the unused local variable.
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|