Skip to content
This repository was archived by the owner on Oct 17, 2022. It is now read-only.

Commit 8ea7586

Browse files
committed
Use str::from_utf8 in tests instead of String::from_utf8
There's no need to make a String (and allocate a new Vec) when the same method is available on &str.
1 parent 903e2a2 commit 8ea7586

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ mod tests {
181181
s[0] = 0;
182182
let is_valid = validate(s);
183183

184-
assert!(is_valid == String::from_utf8(s.to_vec()).is_ok())
184+
assert!(is_valid == std::str::from_utf8(s).is_ok())
185185
}
186186
}
187187
}

0 commit comments

Comments
 (0)