Do not use repeat_n as it was introduced in 1.82

This commit is contained in:
Jeremy Soller 2024-11-11 11:31:32 -07:00
parent 1743730fd9
commit 353bbbee37
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
3 changed files with 16 additions and 3 deletions

12
Cargo.lock generated
View file

@ -1239,6 +1239,7 @@ dependencies = [
"icu_collator",
"icu_provider",
"indexmap",
"itertools 0.13.0",
"lazy_static",
"libcosmic",
"log",
@ -3163,6 +3164,15 @@ dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.11"
@ -4238,7 +4248,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39b0deead1528fd0e5947a8546a9642a9777c25f6e1e26f34c97b204bbb465bd"
dependencies = [
"heck",
"itertools",
"itertools 0.12.1",
"proc-macro2",
"proc-macro2-diagnostics",
"quote",

View file

@ -14,6 +14,8 @@ alacritty_terminal = { git = "https://github.com/alacritty/alacritty", rev = "ca
env_logger = "0.10"
hex_color = { version = "3", features = ["serde"] }
indexmap = "2"
#TODO: for repeat_n, which is in std in 1.82
itertools = "0.13"
lazy_static = "1"
log = "0.4"
open = "5.0.2"

View file

@ -224,8 +224,9 @@ impl MouseReporter {
};
//Generate term codes
let x_iter = std::iter::repeat_n(button_no_x, lines_x.unsigned_abs() as _);
let y_iter = std::iter::repeat_n(button_no_y, lines_y.unsigned_abs() as _);
//TODO: std::iter::repeat_n only available in 1.82
let x_iter = itertools::repeat_n(button_no_x, lines_x.unsigned_abs() as _);
let y_iter = itertools::repeat_n(button_no_y, lines_y.unsigned_abs() as _);
x_iter
.chain(y_iter)