Skip to content

Commit d754f7a

Browse files
committed
[ci skip] make clippy happy
1 parent 1aff680 commit d754f7a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/data.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ impl Data {
160160
.read(true)
161161
.write(true)
162162
.create(true)
163+
.truncate(true)
163164
.open(path)
164165
.await
165166
.unwrap()
@@ -169,9 +170,7 @@ impl Data {
169170
None => None,
170171
};
171172

172-
let mut data: Vec<u32> = Vec::with_capacity(RESOLUTION);
173-
data.resize(RESOLUTION, 0);
174-
173+
let mut data: Vec<u32> = vec![0; RESOLUTION];
175174
if file.is_some() {
176175
let mut file_data: Vec<u8> = Vec::with_capacity(RESOLUTION * 4);
177176
file.as_mut()
@@ -191,6 +190,7 @@ impl Data {
191190
let task_data = Arc::clone(&data);
192191
if file.is_some() && save {
193192
tokio::spawn(async move {
193+
#[allow(clippy::unnecessary_unwrap)]
194194
let mut file = file.unwrap();
195195

196196
loop {
@@ -204,8 +204,7 @@ impl Data {
204204
file.write_all(
205205
&data
206206
.iter()
207-
.map(|data| data.to_le_bytes())
208-
.flatten()
207+
.flat_map(|data| data.to_le_bytes())
209208
.collect::<Vec<u8>>(),
210209
)
211210
.await

0 commit comments

Comments
 (0)