Skip to content

Commit 29e56ac

Browse files
authored
crypto-square: replace repeated push with resize (#1025)
clippy::same_item_push https://rust-lang.github.io/rust-clippy/master/index.html#same_item_push Helps address #1012
1 parent 3ee152a commit 29e56ac

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

exercises/crypto-square/example.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ fn prepare(input: &str) -> Vec<char> {
4747
// add space padding to the end such that the actual string returned
4848
// forms a perfect rectangle
4949
let (r, c) = dimensions(output.len());
50-
let padding_qty = (r * c) - output.len();
51-
for _ in 0..padding_qty {
52-
output.push(' ');
53-
}
50+
output.resize(r * c, ' ');
5451

5552
output.shrink_to_fit();
5653

0 commit comments

Comments
 (0)