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

Commit

Permalink
Use str::from_utf8 in tests instead of String::from_utf8
Browse files Browse the repository at this point in the history
There's no need to make a String (and allocate a new Vec) when the same
method is available on &str.
  • Loading branch information
milkey-mouse committed Jun 30, 2020
1 parent addaf8c commit 6243245
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ mod tests {
s[0] = 0;
let is_valid = validate(s);

assert!(is_valid == String::from_utf8(s.to_vec()).is_ok())
assert!(is_valid == std::str::from_utf8(s).is_ok())
}
}
}
Expand Down

0 comments on commit 6243245

Please sign in to comment.