Normalize doc attributes in generated code

This commit is contained in:
David Tolnay 2019-02-07 23:36:17 +01:00
parent f8e08958c3
commit 531603545f
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
4 changed files with 23 additions and 22 deletions

View File

@ -996,6 +996,7 @@ fn write_file(path: &str, content: TokenStream) {
config.set().emit_mode(rustfmt::EmitMode::Stdout);
config.set().verbose(rustfmt::Verbosity::Quiet);
config.set().format_macro_matchers(true);
config.set().normalize_doc_attributes(true);
let mut session = rustfmt::Session::new(config, Some(&mut file));
session
.format(rustfmt::Input::Text(content.to_string()))

View File

@ -19,13 +19,13 @@ macro_rules! full {
unreachable!()
};
}
#[doc = r" Syntax tree traversal to transform the nodes of an owned syntax tree."]
#[doc = r""]
#[doc = r" See the [module documentation] for details."]
#[doc = r""]
#[doc = r" [module documentation]: index.html"]
#[doc = r""]
#[doc = r#" *This trait is available if Syn is built with the `"fold"` feature.*"#]
/// Syntax tree traversal to transform the nodes of an owned syntax tree.
///
/// See the [module documentation] for details.
///
/// [module documentation]: index.html
///
/// *This trait is available if Syn is built with the `"fold"` feature.*
pub trait Fold {
#[cfg(any(feature = "full", feature = "derive"))]
fn fold_abi(&mut self, i: Abi) -> Abi {

View File

@ -23,13 +23,13 @@ macro_rules! full {
macro_rules! skip {
($($tt:tt)*) => {};
}
#[doc = r" Syntax tree traversal to walk a shared borrow of a syntax tree."]
#[doc = r""]
#[doc = r" See the [module documentation] for details."]
#[doc = r""]
#[doc = r" [module documentation]: index.html"]
#[doc = r""]
#[doc = r#" *This trait is available if Syn is built with the `"visit"` feature.*"#]
/// Syntax tree traversal to walk a shared borrow of a syntax tree.
///
/// See the [module documentation] for details.
///
/// [module documentation]: index.html
///
/// *This trait is available if Syn is built with the `"visit"` feature.*
pub trait Visit<'ast> {
#[cfg(any(feature = "full", feature = "derive"))]
fn visit_abi(&mut self, i: &'ast Abi) {

View File

@ -22,14 +22,14 @@ macro_rules! full {
macro_rules! skip {
($($tt:tt)*) => {};
}
#[doc = r" Syntax tree traversal to mutate an exclusive borrow of a syntax tree in"]
#[doc = r" place."]
#[doc = r""]
#[doc = r" See the [module documentation] for details."]
#[doc = r""]
#[doc = r" [module documentation]: index.html"]
#[doc = r""]
#[doc = r#" *This trait is available if Syn is built with the `"visit-mut"` feature.*"#]
/// Syntax tree traversal to mutate an exclusive borrow of a syntax tree in
/// place.
///
/// See the [module documentation] for details.
///
/// [module documentation]: index.html
///
/// *This trait is available if Syn is built with the `"visit-mut"` feature.*
pub trait VisitMut {
#[cfg(any(feature = "full", feature = "derive"))]
fn visit_abi_mut(&mut self, i: &mut Abi) {