-
-
Notifications
You must be signed in to change notification settings - Fork 128
Expand file tree
/
Copy pathenum_missing.ron
More file actions
61 lines (57 loc) · 2.33 KB
/
enum_missing.ron
File metadata and controls
61 lines (57 loc) · 2.33 KB
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
SemverQuery(
id: "enum_missing",
human_readable_name: "pub enum removed or renamed",
description: "An enum can no longer be imported by its prior path.",
required_update: Major,
lint_level: Deny,
reference_link: Some("https://doc.rust-lang.org/cargo/reference/semver.html#item-remove"),
query: r#"
{
CrateDiff {
baseline {
item {
... on Enum {
visibility_limit @filter(op: "=", value: ["$public"]) @output
name @output
importable_path {
path @output @tag
public_api @filter(op: "=", value: ["$true"])
}
span_: span @optional {
filename @output
begin_line @output
end_line @output
}
}
}
}
current {
# If the enum's path is now a struct/union/trait, that's covered by
# the enum_changed_kind lint instead of reporting it as missing.
item @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
... on ImplOwner {
visibility_limit @filter(op: "=", value: ["$public"])
importable_path {
path @filter(op: "=", value: ["%path"])
}
}
}
item @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
... on Trait {
visibility_limit @filter(op: "=", value: ["$public"])
importable_path {
path @filter(op: "=", value: ["%path"])
}
}
}
}
}
}"#,
arguments: {
"public": "public",
"zero": 0,
"true": true,
},
error_message: "A publicly-visible enum cannot be imported by its prior path. A `pub use` may have been removed, or the enum itself may have been renamed or removed entirely.",
per_result_error_template: Some("enum {{join \"::\" path}}, previously in file {{span_filename}}:{{span_begin_line}}"),
)