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.
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user