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

or_fun_call warns on enum variant construction. #917

Closed
Stebalien opened this issue May 11, 2016 · 4 comments · Fixed by #919
Closed

or_fun_call warns on enum variant construction. #917

Stebalien opened this issue May 11, 2016 · 4 comments · Fixed by #919
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@Stebalien
Copy link

I have the following line in my project:

self.write_to_fmt(&mut Adapter(f)).or(Err(fmt::Error))

Err(fmt::Error) is a constant but clippy complains that I'm calling a function.

@mcarton
Copy link
Member

mcarton commented May 11, 2016

Err (as all parametered enum variants) is also a function. But Clippy should not warn there indeed.

@mcarton mcarton added the C-bug Category: Clippy is not doing the correct thing label May 11, 2016
@llogiq
Copy link
Contributor

llogiq commented May 11, 2016

I've seen other instances where functions that were basically constructors (and fully inclined) were suggested to use lazily. Alas, we don't have a measurement for 'this is expensive' in clippy. Perhaps the message should reflect this.

@Stebalien
Copy link
Author

Thanks!

@llogiq
Copy link
Contributor

llogiq commented May 12, 2016

Thank you for letting us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants