Skip to content

Commit d5a2548

Browse files
committed
Clippies
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
1 parent e97ca00 commit d5a2548

File tree

5 files changed

+18
-23
lines changed

5 files changed

+18
-23
lines changed

crates/blobstore-azure/src/store/incoming_data.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ impl AzureIncomingData {
3838
fn consume_as_stream(&mut self) -> impl futures::stream::Stream<Item = Result<Vec<u8>, std::io::Error>> {
3939
let opt_stm = self.stm.get_mut();
4040
let stm = opt_stm.take().unwrap();
41-
let byte_stm = stm.flat_map(|chunk| streamify_chunk(chunk.unwrap().data));
42-
byte_stm
41+
stm.flat_map(|chunk| streamify_chunk(chunk.unwrap().data))
4342
}
4443
}
4544

crates/blobstore-azure/src/store/object_names.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ impl AzureObjectNames {
6363

6464
if names.len() <= len {
6565
// We can send them all!
66-
return Ok((names, at_end));
66+
Ok((names, at_end))
6767
} else {
6868
// We have more names than we can send in this response. Send what we can and
6969
// stash the rest.
7070
let to_return: Vec<_> = names.drain(0..len).collect();
7171
self.read_but_not_yet_returned = names;
7272
self.end_stm_after_read_but_not_yet_returned = at_end;
73-
return Ok((to_return, false));
73+
Ok((to_return, false))
7474
}
7575
}
7676
}

crates/blobstore-s3/src/store.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,7 @@ impl S3IncomingData {
267267
let rr = self.get_obj_resp.take().expect("get object resp was already consumed");
268268
let ar = rr.body.into_async_read();
269269
let s = tokio_util::io::ReaderStream::new(ar);
270-
let vec_stm = s.map(|by| by.map(|b| b.to_vec()));
271-
vec_stm
270+
s.map(|by| by.map(|b| b.to_vec()))
272271
}
273272
}
274273

@@ -319,14 +318,14 @@ impl S3BlobsList {
319318

320319
if names.len() <= len {
321320
// We can send them all!
322-
return Ok((names, at_end));
321+
Ok((names, at_end))
323322
} else {
324323
// We have more names than we can send in this response. Send what we can and
325324
// stash the rest.
326325
let to_return: Vec<_> = names.drain(0..len).collect();
327326
self.read_but_not_yet_returned = names;
328327
self.end_stm_after_read_but_not_yet_returned = at_end;
329-
return Ok((to_return, false));
328+
Ok((to_return, false))
330329
}
331330
}
332331
}

crates/factor-blobstore/src/host.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub struct WasiImplInner<'a> {
126126
pub table: &'a mut ResourceTable,
127127
}
128128

129-
impl<'a> wasmtime_wasi::WasiView for WasiImplInner<'a> {
129+
impl wasmtime_wasi::WasiView for WasiImplInner<'_> {
130130
fn ctx(&mut self) -> &mut wasmtime_wasi::WasiCtx {
131131
self.ctx
132132
}
@@ -171,7 +171,7 @@ impl<'a> BlobStoreDispatch<'a> {
171171
}
172172
}
173173

174-
impl<'a> wb::Host for BlobStoreDispatch<'a> {
174+
impl wb::Host for BlobStoreDispatch<'_> {
175175
async fn create_container(&mut self, _name: String) -> Result<Resource<wbc::Container>, String> {
176176
Err("This version of Spin does not support creating containers".to_owned())
177177
}
@@ -208,13 +208,13 @@ impl<'a> wb::Host for BlobStoreDispatch<'a> {
208208
}
209209
}
210210

211-
impl<'a> wbt::Host for BlobStoreDispatch<'a> {
211+
impl wbt::Host for BlobStoreDispatch<'_> {
212212
fn convert_error(&mut self, error: String) -> anyhow::Result<String> {
213213
Ok(error)
214214
}
215215
}
216216

217-
impl<'a> wbt::HostIncomingValue for BlobStoreDispatch<'a> {
217+
impl wbt::HostIncomingValue for BlobStoreDispatch<'_> {
218218
async fn incoming_value_consume_sync(&mut self, self_: Resource<wbt::IncomingValue>) -> Result<Vec<u8>, String> {
219219
let mut incoming = self.take_incoming_value(self_).await?;
220220
incoming.as_mut().consume_sync().await.map_err(|e| e.to_string())
@@ -240,7 +240,7 @@ impl<'a> wbt::HostIncomingValue for BlobStoreDispatch<'a> {
240240
}
241241
}
242242

243-
impl<'a> wbt::HostOutgoingValue for BlobStoreDispatch<'a> {
243+
impl wbt::HostOutgoingValue for BlobStoreDispatch<'_> {
244244
async fn new_outgoing_value(&mut self) -> anyhow::Result<Resource<wbt::OutgoingValue>> {
245245
let outgoing_value = OutgoingValue::new();
246246
let rep = self.outgoing_values.write().await.push(outgoing_value).unwrap();
@@ -286,9 +286,9 @@ impl<'a> wbt::HostOutgoingValue for BlobStoreDispatch<'a> {
286286
}
287287

288288
// TODO: TBD if these belong on BSD or some other struct (like the one that maps to a Container resource JUST SAYIN)
289-
impl<'a> wbc::Host for BlobStoreDispatch<'a> {}
289+
impl wbc::Host for BlobStoreDispatch<'_> {}
290290

291-
impl<'a> wbc::HostContainer for BlobStoreDispatch<'a> {
291+
impl wbc::HostContainer for BlobStoreDispatch<'_> {
292292
async fn name(&mut self, self_: Resource<wbc::Container>) -> Result<String, String> {
293293
let lock = self.containers.read().await;
294294
let container = lock.get(self_.rep()).ok_or_else(||
@@ -387,7 +387,7 @@ impl<'a> wbc::HostContainer for BlobStoreDispatch<'a> {
387387
}
388388
}
389389

390-
impl<'a> wbc::HostStreamObjectNames for BlobStoreDispatch<'a> {
390+
impl wbc::HostStreamObjectNames for BlobStoreDispatch<'_> {
391391
async fn read_stream_object_names(&mut self, self_: Resource<wbc::StreamObjectNames>, len: u64) -> Result<(Vec<String>,bool), String> {
392392
let mut lock = self.object_names.write().await;
393393
let object_names = lock.get_mut(self_.rep()).ok_or_else(||

crates/factor-blobstore/src/stream/write_stream.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ impl Worker {
6868
}
6969
fn check_write(&self) -> Result<usize, StreamError> {
7070
let mut state = self.state();
71-
if let Err(e) = state.check_error() {
72-
return Err(e);
73-
}
71+
state.check_error()?;
7472

7573
if state.flush_pending || state.shutdown_pending || state.write_budget == 0 {
7674
return Ok(0);
@@ -256,10 +254,9 @@ impl HostOutputStream for AsyncWriteStream {
256254
if let Some(handle) = self.shutdown_join_handle.take() {
257255
handle.abort();
258256
};
259-
match self.join_handle.take() {
260-
Some(task) => _ = cancel(task).await,
261-
None => {}
262-
}
257+
if let Some(task) = self.join_handle.take() {
258+
_ = cancel(task).await;
259+
};
263260
}
264261
}
265262
#[spin_core::async_trait]

0 commit comments

Comments
 (0)