-
Notifications
You must be signed in to change notification settings - Fork 61
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
source(from)
could imply source(true)
#124
Comments
This may be trivial to add with #109 while I'm finishing that up, but it's not strictly related to the error handling changes so I wanted to represent it as a separate issue. |
To be pedantic, |
That's indeed what I meant - updated the description! I have a commit (auto-linked above) that accomplishes this, and adds the updated compile-fail cases, a unit test, and a doc update. It's based on #109 so I was waiting for that to get merged before making an official PR here, so that I didn't need to do the dance of changing base branch. Feel free to assign this issue to me and remove the help wanted, if you like! |
In #109, when considering the field attributes that can work together, there was some agreement that
source(true)
andsource(from)
make sense together on a field.source(true)
indicates that a field is the source even though it can't be named "source".source(from(...))
tells Snafu how to transform another type into the type indicated in the field. (See https://docs.rs/snafu/0.4.3/snafu/guide/attributes/index.html#transforming-the-source). There's no conflict in these intentions.Moreover, if you specify
source(from)
on a field, you almost certainly mean for that to implysource(true)
- you've already said "source" once, and it's a conflict to specifysource(false)
andsource(from)
. It's not the case today, though - thesource(from)
attribute would be ignored if there weren't some other signal that the field is a source.It'd reduce line count and cognitive overhead to have
source(from)
imply that the field is a source.source(true)
on the same field would still be valid, just redundant.The text was updated successfully, but these errors were encountered: