cargo-semver-checks 0.30.0

Scan your Rust crate for semver violations.
Documentation
SemverQuery(
    id: "unit_struct_changed_kind",
    human_readable_name: "unit struct changed kind",
    description: "A struct changed from a unit struct to a plain struct.",
    reference: Some("A public struct that was previously a unit struct is now a plain struct. The unit struct was not marked #[non_exhaustive], so it could be constructed outside of the defining crate. Plain structs cannot be constructed using the syntax allowed for unit structs, so this is a major breaking change for code that depends on it."),
    required_update: Major,

    // TODO: Change the reference link once this cargo docs PR merges:
    // https://github.com/rust-lang/cargo/pull/10871
    //
    // Change to this link:
    // https://doc.rust-lang.org/cargo/reference/semver.html#struct-unit-to-normal
    reference_link: Some("https://github.com/rust-lang/cargo/pull/10871"),
    query: r#"
    {
        CrateDiff {
            baseline {
                item {
                    ... on Struct {
                        visibility_limit @filter(op: "=", value: ["$public"]) @output
                        struct_type @filter(op: "=", value: ["$unit"])
                        attrs @filter(op: "not_contains", value: ["$non_exhaustive"])

                        importable_path {
                            path @output @tag
                            public_api @filter(op: "=", value: ["$true"])
                        }
                    }
                }
            }
            current {
                item {
                    ... on Struct {
                        visibility_limit @filter(op: "=", value: ["$public"])
                        name @output
                        struct_type @filter(op: "=", value: ["$plain"])

                        importable_path {
                            path @filter(op: "=", value: ["%path"])
                            public_api @filter(op: "=", value: ["$true"])
                        }

                        span_: span @optional {
                            filename @output
                            begin_line @output
                        }
                    }
                }
            }
        }
    }"#,
    arguments: {
        "public": "public",
        "unit": "unit",
        "plain": "plain",
        "non_exhaustive": "#[non_exhaustive]",
        "true": true,
    },
    error_message: "A public unit struct has been changed to a normal (curly-braces) struct, which cannot be constructed using the same struct literal syntax.",
    per_result_error_template: Some("struct {{name}} in {{span_filename}}:{{span_begin_line}}"),
)