Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

add alternate implementations of error_chain that do not require types section #8

Merged
merged 2 commits into from
Jul 21, 2016
Merged

Conversation

lily-mara
Copy link

I added two alternate implementations of the error_chain macro. One allows for an empty types block, the other leaves the types block out entirely. This should fix #5. I also ran rustfmt on lib.rs and quick_error.rs.

@brson
Copy link
Contributor

brson commented Jul 21, 2016

@natemara Thank you so much! The comments look like they've been mis-formatted though (they're all unindented now). Can you take a look?

@lily-mara
Copy link
Author

This looks like an issue with rustfmt not handling long lines correctly in macro_rules! blocks. For the time being, I'll shorten the offending line by breaking it in two. I have opened an issue with rustfmt

rust-lang/rustfmt#1105

@@ -331,7 +331,9 @@ macro_rules! quick_error {
(FIND_DISPLAY_IMPL $name:ident $item:ident: $imode:tt
{ display($self_:tt) -> ($( $exprs:tt )*) $( $tail:tt )*}
) => {
|quick_error!(IDENT $self_): &$name, f: &mut ::std::fmt::Formatter| { write!(f, $( $exprs )*) }
Copy link
Author

Choose a reason for hiding this comment

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

This is the line that was causing problems. Rustfmt will complain if you have a line longer than 100 characters.

@brson
Copy link
Contributor

brson commented Jul 21, 2016

Just one last nit.

@brson brson merged commit 801be38 into rust-lang-deprecated:master Jul 21, 2016
@brson
Copy link
Contributor

brson commented Jul 21, 2016

I'll fix the remaining indent in a followup. Thanks @natemara !

@lily-mara
Copy link
Author

Glad to help!

@brson
Copy link
Contributor

brson commented Jul 21, 2016

@natemara I've published this as error-chain 0.2.2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow the 'types' section of the macro to be empty
2 participants