File tree 3 files changed +184
-35
lines changed 3 files changed +184
-35
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,21 @@ fn gcd_list(list: &[u64]) -> u64 {
79
79
#[snippet(prefix = " use std::str::FromStr;" )]
80
80
fn foo () {}
81
81
82
+ // By default, doc comments associated with items will be output with the snippet.
83
+ #[snippet]
84
+ /// This is a document!
85
+ fn documented () {
86
+ // ! Inner document also works.
87
+ }
88
+
89
+ // If you want it to be hidden, append `doc_hidden` keyword.
90
+ #[snippet(doc_hidden, prefix = " use std::collections::HashMap;" )]
91
+ /// This is a doc comment for `bar`.
92
+ /// Since `doc_hidden` is specified, it won't be present in the snippet.
93
+ fn bar () {
94
+ // ! And this is also a doc comment for `bar`, which will be removed.
95
+ }
96
+
82
97
#[test]
83
98
fn test_gcd () {
84
99
assert_eq! (gcd (57 , 3 ), 3 );
@@ -105,6 +120,16 @@ snippet foo
105
120
use std::str::FromStr;
106
121
fn foo() {}
107
122
123
+ snippet documented
124
+ /// This is a document!
125
+ fn documented() {
126
+ //! Inner document also works.
127
+ }
128
+
129
+ snippet bar
130
+ use std::collections::HashMap;
131
+ fn bar() {}
132
+
108
133
snippet gcd
109
134
fn gcd(a: u64, b: u64) -> u64 {
110
135
if b == 0 {
@@ -156,4 +181,4 @@ My snippets [here](https://github.com/hatoo/competitive-rust-snippets.git).
156
181
* Ultisnips
157
182
158
183
You can specify output format via ` -t ` option.
159
- See ` cargo snippet -h ` .
184
+ See ` cargo snippet -h ` .
You can’t perform that action at this time.
0 commit comments