Replace intersperse with join

This commit is contained in:
pjht 2022-10-21 19:38:00 -05:00
parent ef65bf52fc
commit 71173a0ed0

View File

@ -197,7 +197,6 @@ fn main() -> Result<(), ReplError> {
.with_command( .with_command(
Command::new("ls").about("List the cards in the system"), Command::new("ls").about("List the cards in the system"),
|_, state| { |_, state| {
#[allow(unstable_name_collisions)]
Ok(Some( Ok(Some(
state state
.cpu .cpu
@ -206,8 +205,7 @@ fn main() -> Result<(), ReplError> {
.iter() .iter()
.enumerate() .enumerate()
.map(|(i, card)| format!("Card {i}: {card}")) .map(|(i, card)| format!("Card {i}: {card}"))
.intersperse('\n'.to_string()) .join("\n"),
.collect(),
)) ))
}, },
) )
@ -340,7 +338,6 @@ fn main() -> Result<(), ReplError> {
), ),
} }
} }
#[allow(unstable_name_collisions)]
Ok(Some( Ok(Some(
data.chunks(size.chunk_size()) data.chunks(size.chunk_size())
.enumerate() .enumerate()
@ -348,14 +345,9 @@ fn main() -> Result<(), ReplError> {
format!( format!(
"0x{:x}: ", "0x{:x}: ",
addr + (size.chunk_size() * size.byte_count() * i) as u32 addr + (size.chunk_size() * size.byte_count() * i) as u32
) + &c ) + &c.iter().map(|d| fmt.format(*d, size)).join(" ")
.iter()
.map(|d| fmt.format(*d, size))
.intersperse(" ".to_string())
.collect::<String>()
}) })
.intersperse("\n".to_string()) .join("\n"),
.collect::<String>(),
)) ))
}, },
) )