-
Notifications
You must be signed in to change notification settings - Fork 230
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
Unused self
in trait impl generates warning
#6297
Comments
# Description ## Problem\* Resolves #6297 ## Summary\* Sets `warn_if_unused` to `false` for the `self` parameter of a function if it's for a trait implementation. ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
Why can't we use |
You're right, if we specify the type as I meant that if I just try to use
NB the Rust compiler doesn't seem to like
|
Yep, this is a difference between Rust and Noir. Noir is a bit more permissive with methods, you don't need a |
Aim
On my machine
tests::execution_success::test_trait_impl_base_type
failed with the following error:Expected Behavior
The test should compile without warning.
Bug
The method is an implementation of
Fieldable::to_field
. We can't use_self
to silence this, and Rust does not warn about it.To Reproduce
Workaround
Yes
Workaround Description
Add
let _ = self;
to the method body.Another one suggested in the comments below is to use
_self: Self
(or_: Self
).Additional Context
No response
Project Impact
None
Blocker Context
No response
Nargo Version
No response
NoirJS Version
No response
Proving Backend Tooling & Version
No response
Would you like to submit a PR for this Issue?
Yes
Support Needs
No response
The text was updated successfully, but these errors were encountered: