forked from obi1kenobi/cargo-semver-checks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction_marked_deprecated.ron
59 lines (55 loc) · 2.18 KB
/
function_marked_deprecated.ron
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
SemverQuery(
id: "function_marked_deprecated",
human_readable_name: "function #[deprecated] added",
description: "A function has been newly marked with #[deprecated].",
required_update: Minor,
lint_level: Deny,
reference_link: Some("https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute"),
query: r#"
{
CrateDiff {
current {
item {
... on Function {
visibility_limit @filter(op: "=", value: ["$public"])
name @output
deprecated @filter(op: "=", value: ["$true"])
importable_path {
path @tag @output
public_api @filter(op: "=", value: ["$true"])
}
span_: span @optional {
filename @output
begin_line @output
end_line @output
}
}
}
}
baseline {
item {
... on Function {
visibility_limit @filter(op: "=", value: ["$public"]) @output
deprecated @filter(op: "!=", value: ["$true"])
importable_path {
path @filter(op: "=", value: ["%path"])
public_api @filter(op: "=", value: ["$true"])
}
parameter @fold {
parameters: name @output
}
}
}
}
}
}"#,
arguments: {
"public": "public",
"true": true,
},
error_message: "A function is now #[deprecated]. Downstream crates will get a compiler warning when using this function.",
per_result_error_template: Some("function {{join \"::\" path}} in {{span_filename}}:{{span_begin_line}}"),
witness: (
hint_template: r#"let witness = {{#if parameters}}|{{join ", " parameters}}| {{/if}}{{join "::" path}}({{join ", " parameters}});"#,
),
)