From 9f834b4be1462032a6304d105210f1f921330e87 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Wed, 17 May 2023 00:04:27 +0900 Subject: [PATCH] make fold.rs file --- ast/asdl_rs.py | 1 - ast/src/{fold_helpers.rs => fold.rs} | 8 ++++++-- ast/src/lib.rs | 8 +------- 3 files changed, 7 insertions(+), 10 deletions(-) rename ast/src/{fold_helpers.rs => fold.rs} (91%) diff --git a/ast/asdl_rs.py b/ast/asdl_rs.py index b82ea2b..a8ca11a 100755 --- a/ast/asdl_rs.py +++ b/ast/asdl_rs.py @@ -644,7 +644,6 @@ class FoldImplVisitor(EmitVisitor): class FoldModuleVisitor(EmitVisitor): def visitModule(self, mod): depth = 0 - self.emit("use crate::fold_helpers::Foldable;", depth) FoldTraitDefVisitor(self.file, self.type_info).visit(mod, depth) FoldImplVisitor(self.file, self.type_info).visit(mod, depth) diff --git a/ast/src/fold_helpers.rs b/ast/src/fold.rs similarity index 91% rename from ast/src/fold_helpers.rs rename to ast/src/fold.rs index 4b54966..ccbcc7b 100644 --- a/ast/src/fold_helpers.rs +++ b/ast/src/fold.rs @@ -1,4 +1,6 @@ -use crate::{builtin, fold::Fold, ConversionFlag}; +use super::generic::*; + +use crate::{builtin, ConversionFlag}; pub trait Foldable { type Mapped; @@ -49,7 +51,7 @@ where macro_rules! simple_fold { ($($t:ty),+$(,)?) => { - $(impl $crate::fold_helpers::Foldable for $t { + $(impl $crate::fold::Foldable for $t { type Mapped = Self; #[inline] fn fold + ?Sized>( @@ -70,3 +72,5 @@ simple_fold!( ConversionFlag, builtin::Constant ); + +include!("gen/fold.rs"); diff --git a/ast/src/lib.rs b/ast/src/lib.rs index 12d3714..21cca63 100644 --- a/ast/src/lib.rs +++ b/ast/src/lib.rs @@ -16,13 +16,7 @@ pub trait Node { } #[cfg(feature = "fold")] -mod fold_helpers; -#[cfg(feature = "fold")] -pub mod fold { - use super::generic::*; - - include!("gen/fold.rs"); -} +pub mod fold; #[cfg(feature = "fold")] pub use fold::Fold;