Conversation
|
Right, so about the last remaining lints, they fall in the following categories:
|
The largest reason this isn't some more specific newtype ('do not leak any failure cause that might be weaponized to the client') is backwards compatibility. It was probably a mistake not to use a more specifically named newtype instead. If clippy lints, it should be fixed with the next major version. Does clippy accept some name type aliases instead? This would be a one-liner to change all the definitions in another PR. |
This might be a matter of accepting whether it should be thought of as a 'default'. The other choice here is providing a more descriptive name to the constructor, I tend to agree with clippy that |
Bordering controversy, but the state machines shouldn't be changed. Semantically they should be written like coroutines / generators which just isn't possible right now. I don't think that clippy lints when coroutines consume more space in one particular await than others. This isn't ideal but note that the state is usually stack-allocated anyways and barely moved. Changing the implementation's types or code flow for this lint would at best complicate the readability of a securitiy-critical part, the gains would need to be overwhelming to be convincing imo. It shouldn't really matter greatly for performance (I can be convinced with measurement if you think doing one is worth it). Maybe this should be added to the documentation. What are the instances on error types (and probably the |
|
Oh, it's usually not about changing any paths. It's usually just about boxing a variant of the enum, thereby reducing the stack allocated size, improving performance on But yeah, if they aren't moved a lot, then that's not relevant. As for the error, I'll post the exact ones it complains about later. |
The only one Clippy seems to have a problem with is
|
The result_unit_err lint discourages use of a () type for a public function. Clippy is also smart enough to prevent a type alias such as below: pub type OAuthOpaqueError = (); Resolving this lint would be a breaking change for this library, so let's deffer this until a later time. Each instance of the warning is marked individually instead of a blanket clippy allow configuration to prevent addition of new instances of this warning. Example warning being silenced: error: this returns a `Result<_, ()>` --> oxide-auth/src/primitives/issuer.rs:25:5 | 25 | fn issue(&mut self, grant: Grant) -> Result<IssuedToken, ()>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: use a custom `Error` type instead = help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#result_unit_err Link: https://rust-lang.github.io/rust-clippy/beta/index.html#result_unit_err Link: 197g#183 (comment) Signed-off-by: Abe Kohandel <abe@kodebooth.com>
The result_unit_err lint discourages use of a () type for a public function. Clippy is also smart enough to prevent a type alias such as below: pub type OAuthOpaqueError = (); Resolving this lint would be a breaking change for this library, so let's deffer this until a later time. Each instance of the warning is marked individually instead of a blanket clippy allow configuration to prevent addition of new instances of this warning. Example warning being silenced: error: this returns a `Result<_, ()>` --> oxide-auth/src/primitives/issuer.rs:25:5 | 25 | fn issue(&mut self, grant: Grant) -> Result<IssuedToken, ()>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: use a custom `Error` type instead = help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#result_unit_err Link: https://rust-lang.github.io/rust-clippy/beta/index.html#result_unit_err Link: 197g#183 (comment) Signed-off-by: Abe Kohandel <abe@kodebooth.com>
The result_unit_err lint discourages use of a () type for a public function. Clippy is also smart enough to prevent a type alias such as below: pub type OAuthOpaqueError = (); Resolving this lint would be a breaking change for this library, so let's deffer this until a later time. Each instance of the warning is marked individually instead of a blanket clippy allow configuration to prevent addition of new instances of this warning. Example warning being silenced: error: this returns a `Result<_, ()>` --> oxide-auth/src/primitives/issuer.rs:25:5 | 25 | fn issue(&mut self, grant: Grant) -> Result<IssuedToken, ()>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: use a custom `Error` type instead = help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#result_unit_err Link: https://rust-lang.github.io/rust-clippy/beta/index.html#result_unit_err Link: 197g#183 (comment) Signed-off-by: Abe Kohandel <abe@kodebooth.com>
The result_unit_err lint discourages use of a () type for a public function. Clippy is also smart enough to prevent a type alias such as below: pub type OAuthOpaqueError = (); Resolving this lint would be a breaking change for this library, so let's deffer this until a later time. Each instance of the warning is marked individually instead of a blanket clippy allow configuration to prevent addition of new instances of this warning. Example warning being silenced: error: this returns a `Result<_, ()>` --> oxide-auth/src/primitives/issuer.rs:25:5 | 25 | fn issue(&mut self, grant: Grant) -> Result<IssuedToken, ()>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: use a custom `Error` type instead = help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#result_unit_err Link: https://rust-lang.github.io/rust-clippy/beta/index.html#result_unit_err Link: 197g#183 (comment) Signed-off-by: Abe Kohandel <abe@kodebooth.com>
The result_unit_err lint discourages use of a () type for a public function. Clippy is also smart enough to prevent a type alias such as below: pub type OAuthOpaqueError = (); Resolving this lint would be a breaking change for this library, so let's deffer this until a later time. Each instance of the warning is marked individually instead of a blanket clippy allow configuration to prevent addition of new instances of this warning. Example warning being silenced: error: this returns a `Result<_, ()>` --> oxide-auth/src/primitives/issuer.rs:25:5 | 25 | fn issue(&mut self, grant: Grant) -> Result<IssuedToken, ()>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: use a custom `Error` type instead = help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#result_unit_err Link: https://rust-lang.github.io/rust-clippy/beta/index.html#result_unit_err Link: 197g#183 (comment) Signed-off-by: Abe Kohandel <abe@kodebooth.com>
The result_unit_err lint discourages use of a () type for a public function. Clippy is also smart enough to prevent a type alias such as below: pub type OAuthOpaqueError = (); Resolving this lint would be a breaking change for this library, so let's deffer this until a later time. Each instance of the warning is marked individually instead of a blanket clippy allow configuration to prevent addition of new instances of this warning. Example warning being silenced: error: this returns a `Result<_, ()>` --> oxide-auth/src/primitives/issuer.rs:25:5 | 25 | fn issue(&mut self, grant: Grant) -> Result<IssuedToken, ()>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: use a custom `Error` type instead = help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#result_unit_err Link: https://rust-lang.github.io/rust-clippy/beta/index.html#result_unit_err Link: 197g#183 (comment) Signed-off-by: Abe Kohandel <abe@kodebooth.com>
The result_unit_err lint discourages use of a () type for a public function. Clippy is also smart enough to prevent a type alias such as below: pub type OAuthOpaqueError = (); Resolving this lint would be a breaking change for this library, so let's deffer this until a later time. Each instance of the warning is marked individually instead of a blanket clippy allow configuration to prevent addition of new instances of this warning. Example warning being silenced: error: this returns a `Result<_, ()>` --> oxide-auth/src/primitives/issuer.rs:25:5 | 25 | fn issue(&mut self, grant: Grant) -> Result<IssuedToken, ()>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: use a custom `Error` type instead = help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#result_unit_err Link: https://rust-lang.github.io/rust-clippy/beta/index.html#result_unit_err Link: 197g#183 (comment) Signed-off-by: Abe Kohandel <abe@kodebooth.com>
This PR has no real public changes, more of a generic fixing of clippy lints.
I just noticed a bunch of warnings since my RA install runs
cargo clippyinstead ofcargo check.Thought it might be a few nice fixes, especially reducing the complexity of some function signatures by removing unnecessary explicit lifetimes.
I license past and future contributions under the dual MIT/Apache-2.0 license, allowing licensees to chose either at their option.