Skip to content

Carefully formatted columns (matrix literal example) #2924

Closed
@anderejd

Description

@anderejd

Here's one interesting really bad case I just found:

             self.projection_matrix = Matrix4::new(
-                1.0/r, 0.0,   0.0,         0.0,   // NOTE: first column!
-                0.0,   1.0/t, 0.0,         0.0,   // 2nd
-                0.0,   0.0,   2.0/(n-f),   0.0,   // 3rd
-                0.0,   0.0,   (f+n)/(n-f), 1.0    // 4th
+                1.0 / r,
+                0.0,
+                0.0,
+                0.0, // NOTE: first column!
+                0.0,
+                1.0 / t,
+                0.0,
+                0.0, // 2nd
+                0.0,
+                0.0,
+                2.0 / (n - f),
+                0.0, // 3rd
+                0.0,
+                0.0,
+                (f + n) / (n - f),
+                1.0, // 4th
             );

Would it be possible to avoid breaking the formatting on a few select blocks? Maybe by some magic comment or by looking for lines that end with comments like this example?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions