Allow 'unused_doc_comments' on generated doctests.

This commit is contained in:
Sergio Benitez 2022-04-19 13:13:29 -07:00
parent 2a7eac01bb
commit bc2315943b
2 changed files with 4 additions and 3 deletions

View File

@ -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 full_path = Path::new(&manifest_dir).join(&path).display().to_string();
tests.push(quote_spanned!(root_glob.span() =>
#[allow(unused_doc_comments)]
mod #ident {
macro_rules! doc_comment { ($x:expr) => (#[doc = $x] extern {}); }
doc_comment!(include_str!(#full_path));

View File

@ -672,9 +672,9 @@ generated.
#[get("/<id>/<name>?<age>")]
fn person(id: Option<usize>, name: &str, age: Option<u8>) { /* .. */ }
/// 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`
/// or `_`) as its in the query part and is allowed to be ignored.
// 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`
// or `_`) as its in the query part and is allowed to be ignored.
let mike = uri!(person(id = 101, name = "Mike", age = Some(28)));
assert_eq!(mike.to_string(), "/101/Mike?age=28");
```