Skip to content

Commit

Permalink
Use as_bytes() instead of chars() for ASCII strings (#1872)
Browse files Browse the repository at this point in the history
[no important files changed]
  • Loading branch information
BillQK authored Mar 27, 2024
1 parent 80d9a18 commit 6ba0922
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions exercises/practice/minesweeper/tests/minesweeper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ fn remove_annotations(board: &[&str]) -> Vec<String> {
}

fn remove_annotations_in_row(row: &str) -> String {
row.chars()
.map(|ch| match ch {
'*' => '*',
row.as_bytes()
.iter()
.map(|&ch| match ch {
b'*' => '*',
_ => ' ',
})
.collect()
Expand Down

0 comments on commit 6ba0922

Please sign in to comment.