Skip to content

Commit 650a44c

Browse files
ysaito1001Harry Barber
authored andcommitted
Address clippy warnings in pokemon-service (#2399)
Co-authored-by: Yuki Saito <[email protected]>
1 parent cd7d285 commit 650a44c

File tree

1 file changed

+3
-4
lines changed
  • rust-runtime/aws-smithy-http-server/examples/pokemon-service/src

1 file changed

+3
-4
lines changed

rust-runtime/aws-smithy-http-server/examples/pokemon-service/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ pub async fn capture_pokemon(
226226
Some(event) => {
227227
let capturing_event = event.as_event();
228228
if let Ok(attempt) = capturing_event {
229-
let payload = attempt.payload.clone().unwrap_or(CapturingPayload::builder().build());
230-
let pokeball = payload.pokeball.as_ref().map(|ball| ball.as_str()).unwrap_or("");
229+
let payload = attempt.payload.clone().unwrap_or_else(|| CapturingPayload::builder().build());
230+
let pokeball = payload.pokeball.as_deref().unwrap_or("");
231231
if ! matches!(pokeball, "Master Ball" | "Great Ball" | "Fast Ball") {
232232
yield Err(
233233
crate::error::CapturePokemonEventsError::InvalidPokeballError(
@@ -250,8 +250,7 @@ pub async fn capture_pokemon(
250250
let shiny = rand::thread_rng().gen_range(0..4096) == 0;
251251
let pokemon = payload
252252
.name
253-
.as_ref()
254-
.map(|name| name.as_str())
253+
.as_deref()
255254
.unwrap_or("")
256255
.to_string();
257256
let pokedex: Vec<u8> = (0..255).collect();

0 commit comments

Comments
 (0)