SemverQuery(
id: "function_no_longer_unsafe",
human_readable_name: "pub fn no longer unsafe",
description: "A pub function is no longer unsafe to call.",
required_update: Minor,
lint_level: Allow,
reference_link: Some("https://doc.rust-lang.org/book/ch20-01-unsafe-rust.html#calling-an-unsafe-function-or-method"),
query: r#"
{
CrateDiff {
baseline {
item {
... on Function {
visibility_limit @filter(op: "=", value: ["$public"]) @output
unsafe @filter(op: "=", value: ["$true"])
importable_path {
path @output @tag
public_api @filter(op: "=", value: ["$true"])
}
}
}
}
current {
item {
... on Function {
visibility_limit @filter(op: "=", value: ["$public"])
name @output
unsafe @filter(op: "!=", value: ["$true"])
importable_path {
path @filter(op: "=", value: ["%path"])
public_api @filter(op: "=", value: ["$true"])
}
span_: span @optional {
filename @output
begin_line @output
end_line @output
}
}
}
}
}
}"#,
arguments: {
"public": "public",
"true": true,
},
error_message: "A pub function is no longer `unsafe`. Calls to it that use an `unsafe` block may encounter `unused_unsafe` lints. Reverting this change would also be a major breaking change.",
per_result_error_template: Some("function {{join \"::\" path}} in file {{span_filename}}:{{span_begin_line}}"),
)