Skip to content

Commit

Permalink
doc(visit): Generate rustdoc (#5107)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jul 5, 2022
1 parent def38aa commit 8ea631c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
1 change: 1 addition & 0 deletions crates/swc_css_visit/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(clippy::all)]
#![allow(clippy::ptr_arg)]

Expand Down
1 change: 1 addition & 0 deletions crates/swc_ecma_visit/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// This is not a public api.
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(clippy::all)]
#![allow(clippy::ptr_arg)]

Expand Down
1 change: 1 addition & 0 deletions crates/swc_html_visit/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(clippy::all)]
#![allow(clippy::ptr_arg)]

Expand Down
36 changes: 18 additions & 18 deletions crates/swc_visit_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
NodeVariant: ast_enum_variant_name,
},
{
#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
#[allow(unused_variables)]
fn fn_name<V: ?Sized + Trait>(
Expand All @@ -683,7 +683,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
Trait: Ident::new(mode.trait_name(), call_site()),
},
{
#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
#[allow(unused_variables)]
fn fn_name<V: ?Sized + Trait>(
Expand Down Expand Up @@ -711,7 +711,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
NodeVariant: ast_enum_variant_name,
},
{
#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
#[allow(unused_variables)]
fn fn_name<V: ?Sized + Trait>(
Expand All @@ -732,7 +732,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
Trait: Ident::new(mode.trait_name(), call_site()),
},
{
#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
#[allow(unused_variables)]
fn fn_name<V: ?Sized + Trait>(
Expand Down Expand Up @@ -762,7 +762,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
NodeVariant: ast_enum_variant_name,
},
{
#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
#[allow(unused_variables)]
fn fn_name<'ast, 'r, V: ?Sized + Trait>(
Expand All @@ -789,7 +789,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
Trait: Ident::new(mode.trait_name(), call_site()),
},
{
#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
#[allow(unused_variables)]
fn fn_name<'ast, 'r, V: ?Sized + Trait>(
Expand Down Expand Up @@ -971,7 +971,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
}),

Mode::Visit(VisitorVariant::WithPath) => q!({
#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
pub trait VisitWithPath<V: ?Sized + VisitAstPath> {
fn visit_with_path<'ast, 'r>(
Expand All @@ -990,7 +990,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
'ast: 'r;
}

#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
impl<V, T> VisitWithPath<V> for Box<T>
where
Expand Down Expand Up @@ -1067,7 +1067,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
}
}),
Mode::Fold(VisitorVariant::WithPath) => q!({
#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
pub trait FoldWithPath<V: ?Sized + FoldAstPath> {
fn fold_with_path(self, v: &mut V, ast_path: &mut AstKindPath) -> Self;
Expand All @@ -1077,7 +1077,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
-> Self;
}

#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
impl<V, T> FoldWithPath<V> for Box<T>
where
Expand Down Expand Up @@ -1124,7 +1124,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
}
}),
Mode::VisitMut(VisitorVariant::WithPath) => q!({
#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
pub trait VisitMutWithPath<V: ?Sized + VisitMutAstPath> {
fn visit_mut_with_path(&mut self, v: &mut V, ast_path: &mut AstKindPath);
Expand All @@ -1136,7 +1136,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
);
}

#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
impl<V, T> VisitMutWithPath<V> for Box<T>
where
Expand Down Expand Up @@ -1269,7 +1269,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
default_body,
},
{
#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
impl<V: ?Sized + VisitAstPath> VisitWithPath<V> for [elem_ty] {
fn visit_with_path<'ast, 'r>(
Expand All @@ -1296,7 +1296,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
));

tokens.push_tokens(&q!(Vars { Type: ty }, {
#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
impl<V: ?Sized + VisitAstPath> VisitWithPath<V> for Type {
fn visit_with_path<'ast, 'r>(
Expand Down Expand Up @@ -1328,7 +1328,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
default_body,
},
{
#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
impl<V: ?Sized + VisitAstPath> VisitWithPath<V> for Type {
fn visit_with_path<'ast, 'r>(
Expand Down Expand Up @@ -1443,7 +1443,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
expr,
},
{
#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
impl<V: ?Sized + VisitMutAstPath> VisitMutWithPath<V> for Type {
fn visit_mut_with_path(
Expand Down Expand Up @@ -1495,7 +1495,7 @@ fn make(mode: Mode, stmts: &[Stmt]) -> Quote {
expr,
},
{
#[cfg(feature = "path")]
#[cfg(any(feature = "path", docsrs))]
#[cfg_attr(docsrs, doc(cfg(feature = "path")))]
impl<V: ?Sized + FoldAstPath> FoldWithPath<V> for Type {
fn fold_with_path(
Expand Down Expand Up @@ -2591,7 +2591,7 @@ fn feature_path_attrs() -> Vec<Attribute> {
style: AttrStyle::Outer,
bracket_token: def_site(),
path: q!({ cfg }).parse(),
tokens: q!({ (feature = "path") }).into(),
tokens: q!({ (any(feature = "path", docsrs)) }).into(),
},
Attribute {
pound_token: def_site(),
Expand Down

1 comment on commit 8ea631c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 8ea631c Previous: 5932a0a Ratio
es/full/minify/libraries/antd 1668872361 ns/iter (± 76395792) 1640223769 ns/iter (± 19090376) 1.02
es/full/minify/libraries/d3 419407641 ns/iter (± 24641094) 416789414 ns/iter (± 8815216) 1.01
es/full/minify/libraries/echarts 1711283892 ns/iter (± 75644006) 1646512096 ns/iter (± 41099415) 1.04
es/full/minify/libraries/jquery 106067861 ns/iter (± 14598082) 93324118 ns/iter (± 2689501) 1.14
es/full/minify/libraries/lodash 127857630 ns/iter (± 13333196) 120483246 ns/iter (± 2359613) 1.06
es/full/minify/libraries/moment 53350754 ns/iter (± 14277001) 52609502 ns/iter (± 487832) 1.01
es/full/minify/libraries/react 17468321 ns/iter (± 195221) 17393466 ns/iter (± 86020) 1.00
es/full/minify/libraries/terser 615992606 ns/iter (± 7160896) 601409184 ns/iter (± 9059358) 1.02
es/full/minify/libraries/three 556486052 ns/iter (± 7567368) 544108895 ns/iter (± 5272706) 1.02
es/full/minify/libraries/typescript 3598210310 ns/iter (± 175217837) 3444394769 ns/iter (± 89926496) 1.04
es/full/minify/libraries/victory 738184861 ns/iter (± 28806569) 731924452 ns/iter (± 14191426) 1.01
es/full/minify/libraries/vue 139271728 ns/iter (± 3971915) 147051025 ns/iter (± 11727283) 0.95
es/full/codegen/es3 31180 ns/iter (± 1155) 31695 ns/iter (± 895) 0.98
es/full/codegen/es5 31137 ns/iter (± 1381) 31911 ns/iter (± 1664) 0.98
es/full/codegen/es2015 31220 ns/iter (± 1895) 31728 ns/iter (± 738) 0.98
es/full/codegen/es2016 31194 ns/iter (± 1193) 31520 ns/iter (± 1248) 0.99
es/full/codegen/es2017 31236 ns/iter (± 4492) 31304 ns/iter (± 1023) 1.00
es/full/codegen/es2018 31210 ns/iter (± 2828) 31237 ns/iter (± 758) 1.00
es/full/codegen/es2019 31231 ns/iter (± 1891) 31200 ns/iter (± 853) 1.00
es/full/codegen/es2020 31189 ns/iter (± 5699) 31416 ns/iter (± 1361) 0.99
es/full/all/es3 182392703 ns/iter (± 13677757) 200384737 ns/iter (± 14616052) 0.91
es/full/all/es5 170021326 ns/iter (± 4858330) 185733382 ns/iter (± 10424065) 0.92
es/full/all/es2015 139166660 ns/iter (± 5800099) 154136607 ns/iter (± 9016202) 0.90
es/full/all/es2016 138117384 ns/iter (± 3869255) 151081432 ns/iter (± 7866636) 0.91
es/full/all/es2017 137574346 ns/iter (± 9635885) 155425260 ns/iter (± 8982686) 0.89
es/full/all/es2018 136049904 ns/iter (± 7731731) 147995556 ns/iter (± 7685094) 0.92
es/full/all/es2019 135641337 ns/iter (± 7379895) 145051661 ns/iter (± 6256725) 0.94
es/full/all/es2020 130747124 ns/iter (± 6853446) 135909805 ns/iter (± 8580548) 0.96
es/full/parser 694042 ns/iter (± 31681) 714619 ns/iter (± 23507) 0.97
es/full/base/fixer 28519 ns/iter (± 506) 29474 ns/iter (± 1201) 0.97
es/full/base/resolver_and_hygiene 85466 ns/iter (± 1835) 88210 ns/iter (± 1721) 0.97
serialization of ast node 211 ns/iter (± 4) 222 ns/iter (± 3) 0.95
serialization of serde 223 ns/iter (± 9) 228 ns/iter (± 4) 0.98

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.