Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move parsers to the library #24

Merged
merged 3 commits into from
Dec 16, 2019
Merged

Move parsers to the library #24

merged 3 commits into from
Dec 16, 2019

Conversation

ir210
Copy link
Contributor

@ir210 ir210 commented Dec 10, 2019

No description provided.

src/main.rs Outdated
@@ -93,7 +93,7 @@ fn run() -> Result<(), Error> {
.map(|v| usize::from_str(v).expect("Invalid head arguement"));

let filter = filter::from_args_profile(&args, &profile)?;
let mut parser = parser::Parser::new();
let mut parser = parser::Parser::with_default_rules();
Copy link
Owner

Choose a reason for hiding this comment

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

Think we should implement Default.

src/parser.rs Outdated
pub fn with_default_rules() -> Self {
Parser {
parsers: vec![
Box::new(formats::DefaultParser {}),
Copy link
Owner

Choose a reason for hiding this comment

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

We do not need the {}

src/parser.rs Outdated
Box::new(formats::GTestParser {}),
Box::new(formats::BugReportParser {}),
],
last: None,
}
}

pub fn parse(&mut self, line: String) -> Record {
Copy link
Owner

Choose a reason for hiding this comment

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

Think changing this to &str can avoid to move the String. There is no need to actually move the line.

wngr and others added 2 commits December 16, 2019 11:07
`serde_derive`. Works around the issue, when using `rogcat` as
a library; see serde-rs/serde#1441
1. Implemented Default trait.
2. Removed unnecessary {}s.
3. Use &str instead of String.
@flxo flxo merged commit cb93dd9 into flxo:master Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants