rspec/rules/S1886/cfamily/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

36 lines
716 B
Plaintext

== Why is this an issue?
The modern Objective-C literal syntax should be preferred because it is clearer and easier to read. More importantly, it is easier to use correctly than the original, boxed syntax.
=== Noncompliant code example
[source,cpp]
----
NSNumber *twelve = [NSNumber numberWithInt:(11 + 1)]; // Noncompliant
NSArray *arr = [NSArray arrayWithObjects:@1, @2, @3, nil]; // Noncompliant
----
=== Compliant solution
[source,cpp]
----
NSNumber *twelve = @(11 + 1);
NSArray *arr = @[ @1, @2, @3 ];
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Use the modern "@" syntax for this [type]
endif::env-github,rspecator-view[]