Unverified Commit 18bc7d6a authored by Copilot's avatar Copilot Committed by GitHub
Browse files

Bump MSRV to 1.88.0 and fix collapsible_if lints (#453)



* Initial plan

* Bump MSRV to 1.88.0 and fix clippy lints

Co-authored-by: default avatarNugine <30099658+Nugine@users.noreply.github.com>

* Revert CHANGELOG.md changes as requested

Co-authored-by: default avatarNugine <30099658+Nugine@users.noreply.github.com>

* Changes before error encountered

Co-authored-by: default avatarNugine <30099658+Nugine@users.noreply.github.com>

---------

Co-authored-by: default avatarcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: default avatarNugine <30099658+Nugine@users.noreply.github.com>
parent 22a90df7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ jobs:
      fail-fast: false
      matrix:
        toolchain: 
          - 1.86.0 # MSRV
          - 1.88.0 # MSRV
          - stable
          - nightly
    steps:
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@

|               Toolchain               | Version |
| :-----------------------------------: | :-----: |
|      [Rust](https://rustup.rs/)       | ^1.86.0 |
|      [Rust](https://rustup.rs/)       | ^1.88.0 |
| [just](https://github.com/casey/just) |    ^1.36.0    |
|                [uv](https://github.com/astral-sh/uv)                 |  ^0.5.0  |
|                Docker                 |    -    |
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ resolver = "3"
edition = "2024"
repository = "https://github.com/Nugine/s3s"
license = "Apache-2.0"
rust-version = "1.86.0"
rust-version = "1.88.0"

[workspace.lints.rust]
unsafe_code = "forbid"
+8 −8
Original line number Diff line number Diff line
@@ -264,18 +264,18 @@ fn aws_ty_path(name: &str, ops: &Operations, rust_types: &RustTypes) -> String {
    let aws_name = aws_ty_name(name);

    for suffix in ["Input", "Output", "Error"] {
        if let Some(op_name) = name.strip_suffix(suffix) {
            if ops.contains_key(op_name) {
        if let Some(op_name) = name.strip_suffix(suffix)
            && ops.contains_key(op_name)
        {
            return f!("aws_sdk_s3::operation::{}::{aws_name}", op_name.to_snake_case());
        }
    }
    }

    if let Some(rust::Type::Struct(ty)) = rust_types.get(name) {
        if ty.is_error_type {
    if let Some(rust::Type::Struct(ty)) = rust_types.get(name)
        && ty.is_error_type
    {
        return f!("aws_sdk_s3::types::error::{aws_name}");
    }
    }

    f!("aws_sdk_s3::types::{aws_name}")
}
+38 −40
Original line number Diff line number Diff line
@@ -61,13 +61,13 @@ pub fn collect_rust_types(model: &smithy::Model, ops: &Operations) -> RustTypes
            continue;
        }

        if etag_condition_alias_types.contains(&rs_shape_name.as_str()) {
            if let smithy::Shape::String(shape) = shape {
        if etag_condition_alias_types.contains(&rs_shape_name.as_str())
            && let smithy::Shape::String(shape) = shape
        {
            let ty = rust::Type::alias(&rs_shape_name, "ETagCondition", shape.traits.doc());
            insert(rs_shape_name, ty);
            continue;
        }
        }

        match shape {
            smithy::Shape::Boolean(shape) => {
@@ -442,15 +442,14 @@ fn collect_types_needing_custom_default(rust_types: &RustTypes) -> BTreeSet<Stri

    // Start with Configuration types that can't derive Default
    for (name, rust_type) in rust_types {
        if name.ends_with("Configuration") {
            if let rust::Type::Struct(ty) = rust_type {
                if !can_derive_default(ty, rust_types) {
        if name.ends_with("Configuration")
            && let rust::Type::Struct(ty) = rust_type
            && !can_derive_default(ty, rust_types)
        {
            // Add this type and all its struct dependencies
            collect_struct_dependencies(name, rust_types, &mut types_needing_custom_default);
        }
    }
        }
    }

    types_needing_custom_default
}
@@ -462,8 +461,9 @@ fn collect_struct_dependencies(type_name: &str, rust_types: &RustTypes, result:
    }

    // Only add this type if it can't derive Default
    if let Some(rust::Type::Struct(s)) = rust_types.get(type_name) {
        if !can_derive_default(s, rust_types) {
    if let Some(rust::Type::Struct(s)) = rust_types.get(type_name)
        && !can_derive_default(s, rust_types)
    {
        result.insert(type_name.to_owned());

        // Recursively add struct dependencies that also can't derive Default
@@ -487,7 +487,6 @@ fn collect_struct_dependencies(type_name: &str, rust_types: &RustTypes, result:
        }
    }
}
}

fn collect_type_dependencies(type_name: &str, rust_types: &RustTypes, result: &mut BTreeSet<String>) {
    // Avoid infinite recursion
@@ -898,12 +897,12 @@ fn can_derive_serde(ty: &rust::Struct, rust_types: &RustTypes) -> bool {
                }
                rust::Type::List(list) => {
                    // Check if the list element type can be serialized
                    if let Some(rust::Type::Struct(s)) = rust_types.get(&list.member.type_) {
                        if !can_derive_serde(s, rust_types) {
                    if let Some(rust::Type::Struct(s)) = rust_types.get(&list.member.type_)
                        && !can_derive_serde(s, rust_types)
                    {
                        return false;
                    }
                }
                }
                _ => {}
            }
        }
@@ -1144,11 +1143,10 @@ fn codegen_dto_ext(rust_types: &RustTypes) {
                }
                rust::Type::StrEnum(_) => {
                    if field.option_type {
                        g!("if let Some(ref val) = self.{} {{", field.name);
                        g!("    if val.as_str() == \"\" {{");
                        g!("if let Some(ref val) = self.{}", field.name);
                        g!("    && val.as_str() == \"\" {{");
                        g!("    self.{} = None;", field.name);
                        g!("}}");
                        g!("}}");
                    }
                }
                rust::Type::Struct(field_ty) => {
Loading