pass str ref as parameter

This commit is contained in:
mos 2024-10-28 10:43:00 +01:00
parent b7d7b27566
commit 412072abda
1 changed files with 2 additions and 2 deletions

View File

@ -163,7 +163,7 @@ impl Level {
Ok(Self { size, player, map }) Ok(Self { size, player, map })
} }
fn read_rle(map: String) -> std::result::Result<Self, ReadError> { fn read_rle(map: &str) -> std::result::Result<Self, ReadError> {
let mut n: usize = 1; let mut n: usize = 1;
Self::read( Self::read(
@ -534,7 +534,7 @@ pub fn run(config: Config, rle: Option<String>) -> Result<()> {
} }
let map = if let Some(rle) = rle { let map = if let Some(rle) = rle {
Level::read_rle(rle) Level::read_rle(&rle)
} else { } else {
Level::read(std::io::stdin().lock()) Level::read(std::io::stdin().lock())
} }