From d8d148224c231c4daf4c8d2ef43a64531efc7ad8 Mon Sep 17 00:00:00 2001 From: Brummel Date: Tue, 2 Jun 2026 02:35:17 +0200 Subject: [PATCH] refactor(test): slice the bytes, not the str (sliced_string_as_bytes) `line[..s].as_bytes()` re-walks UTF-8 boundaries to slice the &str first; `&line.as_bytes()[..s]` slices the byte view directly. `s` is a byte offset from `str::find`, so the two are equivalent here. Clears the last clippy warning in the workspace. --- crates/ailang-core/tests/design_index_pin.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ailang-core/tests/design_index_pin.rs b/crates/ailang-core/tests/design_index_pin.rs index 3a8a282..7a49d86 100644 --- a/crates/ailang-core/tests/design_index_pin.rs +++ b/crates/ailang-core/tests/design_index_pin.rs @@ -229,7 +229,7 @@ fn contracts_carry_no_decision_record_prose() { if line.contains("**Status: ") { return Some("**Status:"); } if line.contains("21.g") { return Some("21.g"); } if let Some(s) = line.find(" sketch") { - let pre = line[..s].as_bytes(); + let pre = &line.as_bytes()[..s]; if pre.last().is_some_and(u8::is_ascii_alphanumeric) && pre.iter().rev() .take_while(|c| c.is_ascii_alphanumeric())