cargo-semver-checks 0.48.0

Scan your Rust crate for semver violations.
Documentation
SemverQuery(
    id: "trait_method_receiver_owned_became_ref",
    human_readable_name: "trait method receiver changed from owned self to immutable reference",
    description: "A method in an unsealed pub trait changed its receiver from self to &self.",
    required_update: Major,
    lint_level: Deny,
    reference_link: Some("https://doc.rust-lang.org/cargo/reference/semver.html#trait-item-signature"),
    query: r#"
    {
        CrateDiff {
            baseline {
                item {
                    ... on Trait {
                        visibility_limit @filter(op: "=", value: ["$public"]) @output

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

                        method {
                            method_name: name @output @tag
                            public_api_eligible @filter(op: "=", value: ["$true"])

                            receiver {
                                by_value @filter(op: "=", value: ["$true"])
                                receiver_kind: kind @tag @output
                            }
                        }
                    }
                }
            }
            current {
                item {
                    ... on Trait {
                        visibility_limit @filter(op: "=", value: ["$public"])

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

                        method {
                            name @filter(op: "=", value: ["%method_name"])
                            public_api_eligible @filter(op: "=", value: ["$true"])

                            receiver {
                                by_reference @filter(op: "=", value: ["$true"])
                                kind @filter(op: "=", value: ["%receiver_kind"])
                            }

                            span_: span @optional {
                                filename @output
                                begin_line @output
                                end_line @output
                            }
                        }
                    }
                }
            }
        }
    }"#,
    arguments: {
        "public": "public",
        "true": true,
    },
    error_message: "A trait method now takes &self instead of taking ownership. This breaks calls that use fully-qualified syntax, as well as any downstream implementations of the trait.",
    per_result_error_template: Some("{{join \"::\" path}}::{{method_name}} now takes &{{receiver_kind}} instead of {{receiver_kind}}, in {{span_filename}}:{{span_begin_line}}"),
    // `value.method()` would work;
    // the breakage is `Trait::method(value)` which has to be `Trait::method(&value)`
    witness: None,
)