Skip to content

Commit 948e71e

Browse files
committed
attrs/ is done
1 parent 08d214b commit 948e71e

19 files changed

+57
-71
lines changed

tests/rustdoc-json/attrs/automatically_derived.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ impl Default for Manual {
99
}
1010
}
1111

12-
//@ is '$.index[?(@.inner.impl.for.resolved_path.path == "Derive" && @.inner.impl.trait.path == "Default")].attrs' '["#[automatically_derived]"]'
13-
//@ is '$.index[?(@.inner.impl.for.resolved_path.path == "Manual" && @.inner.impl.trait.path == "Default")].attrs' '[]'
12+
//@ arg default [.index[] | select(.inner.impl.trait?.path == "Default")]
13+
//@ eq $default[] | select(.inner.impl.for?.resolved_path?.path == "Derive").attrs | ., ["#[automatically_derived]"]
14+
//@ eq $default[] | select(.inner.impl.for?.resolved_path?.path == "Manual").attrs | ., []

tests/rustdoc-json/attrs/cold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
//@ is "$.index[?(@.name=='cold_fn')].attrs" '["#[attr = Cold]"]'
1+
//@ eq .index[] | select(.name == "cold_fn").attrs | ., ["#[attr = Cold]"]
22
#[cold]
33
pub fn cold_fn() {}
Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,30 @@
1-
//@ is "$.index[?(@.name=='not')].attrs" []
2-
//@ is "$.index[?(@.name=='not')].deprecation" null
1+
//@ eq .index[] | select(.name == "not") | [.attrs, .deprecation], [[], null]
32
pub fn not() {}
43

5-
//@ is "$.index[?(@.name=='raw')].attrs" []
6-
//@ is "$.index[?(@.name=='raw')].deprecation" '{"since": null, "note": null}'
4+
//@ eq .index[] | select(.name == "raw") | [.attrs, .deprecation], [[], {"since": null, "note": null}]
75
#[deprecated]
86
pub fn raw() {}
97

10-
//@ is "$.index[?(@.name=='equals_string')].attrs" []
11-
//@ is "$.index[?(@.name=='equals_string')].deprecation" '{"since": null, "note": "here is a reason"}'
8+
//@ eq .index[] | select(.name == "equals_string") | [.attrs, .deprecation], [[], {"since": null, "note": "here is a reason"}]
129
#[deprecated = "here is a reason"]
1310
pub fn equals_string() {}
1411

15-
//@ is "$.index[?(@.name=='since')].attrs" []
16-
//@ is "$.index[?(@.name=='since')].deprecation" '{"since": "yoinks ago", "note": null}'
12+
//@ eq .index[] | select(.name == "since") | [.attrs, .deprecation], [[], {"since": "yoinks ago", "note": null}]
1713
#[deprecated(since = "yoinks ago")]
1814
pub fn since() {}
1915

20-
//@ is "$.index[?(@.name=='note')].attrs" []
21-
//@ is "$.index[?(@.name=='note')].deprecation" '{"since": null, "note": "7"}'
16+
//@ eq .index[] | select(.name == "note") | [.attrs, .deprecation], [[], {"since": null, "note": "7"}]
2217
#[deprecated(note = "7")]
2318
pub fn note() {}
2419

25-
//@ is "$.index[?(@.name=='since_and_note')].attrs" []
26-
//@ is "$.index[?(@.name=='since_and_note')].deprecation" '{"since": "tomorrow", "note": "sorry"}'
20+
//@ eq .index[] | select(.name == "since_and_note") | [.attrs, .deprecation], [[], {"since": "tomorrow", "note": "sorry"}]
2721
#[deprecated(since = "tomorrow", note = "sorry")]
2822
pub fn since_and_note() {}
2923

30-
//@ is "$.index[?(@.name=='note_and_since')].attrs" []
31-
//@ is "$.index[?(@.name=='note_and_since')].deprecation" '{"since": "a year from tomorrow", "note": "your welcome"}'
24+
//@ eq .index[] | select(.name == "note_and_since") | [.attrs, .deprecation], [[], {"since": "a year from tomorrow", "note": "your welcome"}]
3225
#[deprecated(note = "your welcome", since = "a year from tomorrow")]
3326
pub fn note_and_since() {}
3427

35-
//@ is "$.index[?(@.name=='neither_but_parens')].attrs" []
36-
//@ is "$.index[?(@.name=='neither_but_parens')].deprecation" '{"since": null, "note": null}'
28+
//@ eq .index[] | select(.name == "neither_but_parens") | [.attrs, .deprecation], [[], {"since": null, "note": null}]
3729
#[deprecated()]
3830
pub fn neither_but_parens() {}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ edition: 2021
22
#![no_std]
33

4-
//@ is "$.index[?(@.name=='example')].attrs" '["#[export_name = \"altered\"]"]'
4+
//@ eq .index[] | select(.name == "example").attrs | ., ["#[export_name = \"altered\"]"]
55
#[export_name = "altered"]
66
pub extern "C" fn example() {}

tests/rustdoc-json/attrs/export_name_2024.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
// The representation of `#[unsafe(export_name = ..)]` in rustdoc in edition 2024
55
// is still `#[export_name = ..]` without the `unsafe` attribute wrapper.
66

7-
//@ is "$.index[?(@.name=='example')].attrs" '["#[export_name = \"altered\"]"]'
7+
//@ eq .index[] | select(.name == "example").attrs | ., ["#[export_name = \"altered\"]"]
88
#[unsafe(export_name = "altered")]
99
pub extern "C" fn example() {}

tests/rustdoc-json/attrs/inline.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
//@ is "$.index[?(@.name=='just_inline')].attrs" '["#[attr = Inline(Hint)]"]'
1+
//@ eq .index[] | select(.name == "just_inline").attrs | ., ["#[attr = Inline(Hint)]"]
22
#[inline]
33
pub fn just_inline() {}
44

5-
//@ is "$.index[?(@.name=='inline_always')].attrs" '["#[attr = Inline(Always)]"]'
5+
//@ eq .index[] | select(.name == "inline_always").attrs | ., ["#[attr = Inline(Always)]"]
66
#[inline(always)]
77
pub fn inline_always() {}
88

9-
//@ is "$.index[?(@.name=='inline_never')].attrs" '["#[attr = Inline(Never)]"]'
9+
//@ eq .index[] | select(.name == "inline_never").attrs | ., ["#[attr = Inline(Never)]"]
1010
#[inline(never)]
1111
pub fn inline_never() {}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ edition: 2021
22
#![no_std]
33

4-
//@ is "$.index[?(@.name=='example')].attrs" '["#[link_section = \".text\"]"]'
4+
//@ eq .index[] | select(.name == "example").attrs | ., ["#[link_section = \".text\"]"]
55
#[link_section = ".text"]
66
pub extern "C" fn example() {}

tests/rustdoc-json/attrs/link_section_2024.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
// Since the 2024 edition the link_section attribute must use the unsafe qualification.
55
// However, the unsafe qualification is not shown by rustdoc.
66

7-
//@ is "$.index[?(@.name=='example')].attrs" '["#[link_section = \".text\"]"]'
7+
//@ eq .index[] | select(.name == "example").attrs | ., ["#[link_section = \".text\"]"]
88
#[unsafe(link_section = ".text")]
99
pub extern "C" fn example() {}

tests/rustdoc-json/attrs/must_use.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#![no_std]
22

3-
//@ is "$.index[?(@.name=='example')].attrs" '["#[attr = MustUse]"]'
3+
//@ eq .index[] | select(.name == "example").attrs | ., ["#[attr = MustUse]"]
44
#[must_use]
55
pub fn example() -> impl Iterator<Item = i64> {}
66

7-
//@ is "$.index[?(@.name=='explicit_message')].attrs" '["#[attr = MustUse {reason: \"does nothing if you do not use it\"}]"]'
7+
//@ eq .index[] | select(.name == "explicit_message").attrs | ., ["#[attr = MustUse {reason: \"does nothing if you do not use it\"}]"]
88
#[must_use = "does nothing if you do not use it"]
99
pub fn explicit_message() -> impl Iterator<Item = i64> {}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ edition: 2021
22
#![no_std]
33

4-
//@ is "$.index[?(@.name=='example')].attrs" '["#[no_mangle]"]'
4+
//@ eq .index[] | select(.name == "example").attrs | ., ["#[no_mangle]"]
55
#[no_mangle]
66
pub extern "C" fn example() {}

0 commit comments

Comments
 (0)