rspec/rules/S3395/rule.adoc
Arseniy Zaostrovnykh 7ca29f686f Force linebreaks
2021-02-02 15:02:10 +01:00

34 lines
548 B
Plaintext

Classes defined inside functions, called local classes, are only visible within those functions. They have advantages in some situations, but if they're just being used as functors, lambdas are preferred.
This rule raises an issue when a ``++class++`` or ``++struct++`` is defined inside a function.
== Noncompliant Code Example
----
void doSomething() {
struct something { // Noncompliant
int a;
};
//...
}
----
== Compliant Solution
----
struct something { // Noncompliant
int a;
};
void doSomething() {
//...
}
----