Skip to content

Commit

Permalink
fix: remove parser method
Browse files Browse the repository at this point in the history
  • Loading branch information
junhaideng committed Feb 20, 2024
1 parent 70adcd1 commit 242be03
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
19 changes: 9 additions & 10 deletions pilota-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub struct Builder<MkB, P> {
keep_unknown_fields: Vec<std::path::PathBuf>,
dedups: Vec<FastStr>,
nonstandard_snake_case: bool,
common_crate_name: FastStr
common_crate_name: FastStr,
}

impl Builder<MkThriftBackend, ThriftParser> {
Expand All @@ -106,7 +106,7 @@ impl Builder<MkThriftBackend, ThriftParser> {
keep_unknown_fields: Vec::default(),
dedups: Vec::default(),
nonstandard_snake_case: false,
common_crate_name: "common".into()
common_crate_name: "common".into(),
}
}
}
Expand Down Expand Up @@ -147,11 +147,10 @@ where
self.nonstandard_snake_case = flag;
self
}

pub fn common_crate_name(mut self, name: FastStr) -> Self {
self.parser.common_crate_name(name.clone());
self.common_crate_name = name;
self
self.common_crate_name = name;
self
}
}

Expand All @@ -168,7 +167,7 @@ impl<MkB, P> Builder<MkB, P> {
keep_unknown_fields: self.keep_unknown_fields,
dedups: self.dedups,
nonstandard_snake_case: self.nonstandard_snake_case,
common_crate_name: self.common_crate_name
common_crate_name: self.common_crate_name,
}
}

Expand Down Expand Up @@ -347,7 +346,7 @@ where
change_case,
dedups,
nonstandard_snake_case,
common_crate_name
common_crate_name,
)
}

Expand All @@ -365,7 +364,7 @@ where
self.keep_unknown_fields,
self.dedups,
self.nonstandard_snake_case,
self.common_crate_name
self.common_crate_name,
);

cx.exec_plugin(BoxedPlugin);
Expand Down Expand Up @@ -447,7 +446,7 @@ where
self.keep_unknown_fields,
self.dedups,
self.nonstandard_snake_case,
self.common_crate_name
self.common_crate_name,
);

std::thread::scope(|_scope| {
Expand Down
4 changes: 2 additions & 2 deletions pilota-build/src/middle/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub struct Context {
pub plugin_gen: DashMap<DefLocation, String>,
pub(crate) dedups: Vec<FastStr>,
pub(crate) nonstandard_snake_case: bool,
pub(crate) common_crate_name: FastStr
pub(crate) common_crate_name: FastStr,
}

impl Clone for Context {
Expand Down Expand Up @@ -448,7 +448,7 @@ impl ContextBuilder {
plugin_gen: Default::default(),
dedups,
nonstandard_snake_case,
common_crate_name
common_crate_name,
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions pilota-build/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::{ir::File, symbol::FileId};
pub(crate) mod protobuf;
pub(crate) mod thrift;

use faststr::FastStr;
use rustc_hash::FxHashMap;
pub use thrift::ThriftParser;

Expand All @@ -31,7 +30,5 @@ pub trait Parser {

fn nonstandard_snake_case(&mut self, _nonstandard: bool) {}

fn common_crate_name(&mut self, _name: FastStr) {}

fn parse(self) -> ParseResult;
}

0 comments on commit 242be03

Please sign in to comment.