SemverQuery(
id: "inherent_method_added",
human_readable_name: "pub inherent method added",
description: "A public type gained a new public inherent method.",
required_update: Minor,
lint_level: Allow,
reference_link: Some("https://doc.rust-lang.org/cargo/reference/semver.html#impl-item-new"),
query: r#"
{
CrateDiff {
current {
item {
... on ImplOwner {
visibility_limit @filter(op: "=", value: ["$public"]) @output
importable_path {
path @output @tag
public_api @filter(op: "=", value: ["$true"])
}
inherent_impl {
public_api_eligible @filter(op: "=", value: ["$true"])
method {
method_name: name @output @tag
public_api_eligible @filter(op: "=", value: ["$true"])
span_: span @optional {
filename @output
begin_line @output
end_line @output
}
}
}
}
}
}
baseline {
item {
... on ImplOwner {
visibility_limit @filter(op: "=", value: ["$public"])
name @output
importable_path {
path @filter(op: "=", value: ["%path"])
public_api @filter(op: "=", value: ["$true"])
}
inherent_impl @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
method {
name @filter(op: "=", value: ["%method_name"])
}
}
}
}
}
}
}"#,
arguments: {
"public": "public",
"true": true,
"zero": 0,
},
error_message: "A new inherent public method was added to an existing public type.",
per_result_error_template: Some("{{name}}::{{method_name}} in {{span_filename}}:{{span_begin_line}}"),
)