diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-06-07 18:10:31 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-06-07 18:10:31 +0200 |
| commit | 6aab04e9b7d89af51eb96fcc35d7b3dab96f940a (patch) | |
| tree | 085c9ce69ce3fa45dcf6e92572237c4f8a948f56 | |
| parent | 3670ad59ade784226515327f2d776f02a6613f2c (diff) | |
| download | rust-6aab04e9b7d89af51eb96fcc35d7b3dab96f940a.tar.gz rust-6aab04e9b7d89af51eb96fcc35d7b3dab96f940a.zip | |
run fmt
| -rw-r--r-- | src/librustdoc/doctest/make.rs | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/librustdoc/doctest/make.rs b/src/librustdoc/doctest/make.rs index 90efcbdd8b1..599611407ed 100644 --- a/src/librustdoc/doctest/make.rs +++ b/src/librustdoc/doctest/make.rs @@ -174,14 +174,13 @@ fn check_for_main_and_extern_crate( let mut found_extern_crate = crate_name.is_none(); let mut found_macro = false; - let mut parser = - match new_parser_from_source_str(&psess, filename, source.clone()) { - Ok(p) => p, - Err(errs) => { - errs.into_iter().for_each(|err| err.cancel()); - return (found_main, found_extern_crate, found_macro); - } - }; + let mut parser = match new_parser_from_source_str(&psess, filename, source.clone()) { + Ok(p) => p, + Err(errs) => { + errs.into_iter().for_each(|err| err.cancel()); + return (found_main, found_extern_crate, found_macro); + } + }; loop { match parser.parse_item(ForceCollect::No) { @@ -280,16 +279,15 @@ fn check_if_attr_is_complete(source: &str, edition: Edition) -> bool { let dcx = DiagCtxt::new(Box::new(emitter)).disable_warnings(); let psess = ParseSess::with_dcx(dcx, sm); - let mut parser = - match new_parser_from_source_str(&psess, filename, source.to_owned()) { - Ok(p) => p, - Err(errs) => { - errs.into_iter().for_each(|err| err.cancel()); - // If there is an unclosed delimiter, an error will be returned by the - // tokentrees. - return false; - } - }; + let mut parser = match new_parser_from_source_str(&psess, filename, source.to_owned()) { + Ok(p) => p, + Err(errs) => { + errs.into_iter().for_each(|err| err.cancel()); + // If there is an unclosed delimiter, an error will be returned by the + // tokentrees. + return false; + } + }; // If a parsing error happened, it's very likely that the attribute is incomplete. if let Err(e) = parser.parse_attribute(InnerAttrPolicy::Permitted) { e.cancel(); |
