-
Notifications
You must be signed in to change notification settings - Fork 927
Use trait to abstract emit modes #3616
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
Conversation
This reverts commit da1e73c.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, this looks great.
src/lib.rs
Outdated
@@ -469,10 +474,23 @@ impl<'b, T: Write + 'b> Session<'b, T> { | |||
} | |||
} | |||
|
|||
pub(crate) fn create_emitter<'a>(config: &Config) -> Box<dyn Emitter + 'a> { | |||
match config.emit_mode() { | |||
EmitMode::Files if config.make_backup() => Box::new(emitter::FilesWithBackupEmitter::new()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to use default()
over an empty constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in dc1a440.
src/test/mod.rs
Outdated
#[cfg(windows)] | ||
assert_eq!(buf, "fn main() {}\r\n".as_bytes()); | ||
assert_eq!(buf, "stdin:\n\r\nfn main() {}\r\n".as_bytes()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
writeln!
only emits the line feed character [1], so the first \r
is unnecessary here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That explains why the windows build was failing 😄. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in a759b83.
LGTM, thank you! |
No description provided.