mirror of https://github.com/rwf2/Rocket.git
Allow 'unused_doc_comments' on generated doctests.
This commit is contained in:
parent
2a7eac01bb
commit
bc2315943b
|
@ -29,6 +29,7 @@ fn entry_to_tests(root_glob: &LitStr) -> Result<Vec<TokenStream>, Box<dyn Error>
|
||||||
let ident = Ident::new(&name.to_lowercase(), root_glob.span());
|
let ident = Ident::new(&name.to_lowercase(), root_glob.span());
|
||||||
let full_path = Path::new(&manifest_dir).join(&path).display().to_string();
|
let full_path = Path::new(&manifest_dir).join(&path).display().to_string();
|
||||||
tests.push(quote_spanned!(root_glob.span() =>
|
tests.push(quote_spanned!(root_glob.span() =>
|
||||||
|
#[allow(unused_doc_comments)]
|
||||||
mod #ident {
|
mod #ident {
|
||||||
macro_rules! doc_comment { ($x:expr) => (#[doc = $x] extern {}); }
|
macro_rules! doc_comment { ($x:expr) => (#[doc = $x] extern {}); }
|
||||||
doc_comment!(include_str!(#full_path));
|
doc_comment!(include_str!(#full_path));
|
||||||
|
|
|
@ -672,9 +672,9 @@ generated.
|
||||||
#[get("/<id>/<name>?<age>")]
|
#[get("/<id>/<name>?<age>")]
|
||||||
fn person(id: Option<usize>, name: &str, age: Option<u8>) { /* .. */ }
|
fn person(id: Option<usize>, name: &str, age: Option<u8>) { /* .. */ }
|
||||||
|
|
||||||
/// Note that `id` is `Option<usize>` in the route, but `id` in `uri!` _cannot_
|
// Note that `id` is `Option<usize>` in the route, but `id` in `uri!` _cannot_
|
||||||
/// be an `Option`. `age`, on the other hand, _must_ be an `Option` (or `Result`
|
// be an `Option`. `age`, on the other hand, _must_ be an `Option` (or `Result`
|
||||||
/// or `_`) as its in the query part and is allowed to be ignored.
|
// or `_`) as its in the query part and is allowed to be ignored.
|
||||||
let mike = uri!(person(id = 101, name = "Mike", age = Some(28)));
|
let mike = uri!(person(id = 101, name = "Mike", age = Some(28)));
|
||||||
assert_eq!(mike.to_string(), "/101/Mike?age=28");
|
assert_eq!(mike.to_string(), "/101/Mike?age=28");
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue