fortrangoingonforty/afs-ld / 7adc761

Browse files

Silence tbd yaml clippy

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
7adc761e1752c1ba2e9ed3d5dfa539c1c1f50ab3
Parents
b924708
Tree
11299d9

1 changed file

StatusFile+-
M src/macho/tbd_yaml.rs 17 14
src/macho/tbd_yaml.rsmodified
@@ -198,15 +198,16 @@ fn strip_eol_comment(s: &mut String) {
198198
                 i += 2;
199199
                 continue;
200200
             }
201
-            b'#' if !in_single && !in_double => {
202
-                // A comment must be preceded by whitespace or be at BOL.
203
-                if i == 0 || bytes[i - 1] == b' ' || bytes[i - 1] == b'\t' {
204
-                    s.truncate(i);
205
-                    // Trim trailing whitespace left by the strip.
206
-                    let trimmed_len = s.trim_end().len();
207
-                    s.truncate(trimmed_len);
208
-                    return;
209
-                }
201
+            b'#'
202
+                if !in_single
203
+                    && !in_double
204
+                    && (i == 0 || bytes[i - 1] == b' ' || bytes[i - 1] == b'\t') =>
205
+            {
206
+                s.truncate(i);
207
+                // Trim trailing whitespace left by the strip.
208
+                let trimmed_len = s.trim_end().len();
209
+                s.truncate(trimmed_len);
210
+                return;
210211
             }
211212
             _ => {}
212213
         }
@@ -426,11 +427,13 @@ fn find_top_level_mapping_colon(s: &str) -> Option<usize> {
426427
             }
427428
             b'[' | b'{' if !in_single && !in_double => depth += 1,
428429
             b']' | b'}' if !in_single && !in_double => depth -= 1,
429
-            b':' if !in_single && !in_double && depth == 0 => {
430
-                // Must be followed by whitespace or end of line per YAML rules.
431
-                if i + 1 == bytes.len() || bytes[i + 1] == b' ' || bytes[i + 1] == b'\t' {
432
-                    return Some(i);
433
-                }
430
+            b':'
431
+                if !in_single
432
+                    && !in_double
433
+                    && depth == 0
434
+                    && (i + 1 == bytes.len() || bytes[i + 1] == b' ' || bytes[i + 1] == b'\t') =>
435
+            {
436
+                return Some(i);
434437
             }
435438
             _ => {}
436439
         }