From 023767e3f39ce043fd8c7154c1397b0f61cadcb3 Mon Sep 17 00:00:00 2001 From: Nugine Date: Sat, 16 Nov 2024 21:27:35 +0800 Subject: [PATCH] fix(codegen): lints --- codegen/src/v1/dto.rs | 4 ++-- codegen/src/v1/ops.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/codegen/src/v1/dto.rs b/codegen/src/v1/dto.rs index c8d06a6..3ef2eef 100644 --- a/codegen/src/v1/dto.rs +++ b/codegen/src/v1/dto.rs @@ -142,7 +142,7 @@ pub fn collect_rust_types(model: &smithy::Model, ops: &Operations) -> RustTypes let default_value = field.traits.default_value().map(o); let is_required = field.traits.required(); - let is_op_input = rs_shape_name.strip_suffix("Request").map_or(false, |op| ops.contains_key(op)); + let is_op_input = rs_shape_name.strip_suffix("Request").is_some_and(|op| ops.contains_key(op)); let option_type = 'optional: { if field_type == "StreamingBlob" && default_value.as_ref().unwrap() == "" { @@ -595,7 +595,7 @@ fn is_default_field(field: &rust::StructField, rust_types: &RustTypes) -> bool { return true; } - field.default_value.as_ref().map_or(false, is_rust_default) + field.default_value.as_ref().is_some_and(is_rust_default) } fn codegen_builders(rust_types: &RustTypes, ops: &Operations) { diff --git a/codegen/src/v1/ops.rs b/codegen/src/v1/ops.rs index f26e7c9..15ded2c 100644 --- a/codegen/src/v1/ops.rs +++ b/codegen/src/v1/ops.rs @@ -118,7 +118,7 @@ pub fn collect_operations(model: &smithy::Model) -> Operations { } pub fn is_op_input(name: &str, ops: &Operations) -> bool { - name.strip_suffix("Input").map_or(false, |x| ops.contains_key(x)) + name.strip_suffix("Input").is_some_and(|x| ops.contains_key(x)) } pub fn codegen(ops: &Operations, rust_types: &RustTypes) {