-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathstruct_must_use_added.ron
68 lines (62 loc) · 2.44 KB
/
struct_must_use_added.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
60
61
62
63
64
65
66
67
68
SemverQuery(
id: "struct_must_use_added",
human_readable_name: "struct #[must_use] added",
description: "A struct has been marked with #[must_use].",
required_update: Minor,
lint_level: Deny,
// TODO: Change the reference link to point to the cargo semver reference
// once it has a section on attribute #[must_use].
reference_link: Some("https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute"),
query: r#"
{
CrateDiff {
current {
item {
... on Struct {
visibility_limit @filter(op: "=", value: ["$public"])
name @output
importable_path {
path @tag @output
public_api @filter(op: "=", value: ["$true"])
}
attribute {
new_attr: raw_attribute @output
content {
base @filter(op: "=", value: ["$must_use"])
}
}
span_: span @optional {
filename @output
begin_line @output
end_line @output
}
}
}
}
baseline {
item {
... on Struct {
visibility_limit @filter(op: "=", value: ["$public"]) @output
importable_path {
path @filter(op: "=", value: ["%path"])
public_api @filter(op: "=", value: ["$true"])
}
attribute @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
content {
base @filter(op: "=", value: ["$must_use"])
}
}
}
}
}
}
}"#,
arguments: {
"public": "public",
"must_use": "must_use",
"true": true,
"zero": 0,
},
error_message: "A struct is now #[must_use]. Downstream crates that did not use its value will get a compiler lint.",
per_result_error_template: Some("struct {{name}} in {{span_filename}}:{{span_begin_line}}"),
)