-
Notifications
You must be signed in to change notification settings - Fork 434
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
Simplify Result<()>
uses and implement a checkpatch.pl
check for it
#1128
Comments
Result<()>
usesResult<()>
uses and implement a checkpatch.pl
check for it
probe returns a `Result<()>` type, which can be simplified as `Result`, due to default type parameters being unit `()` and `Error` types. This maintains a consistent usage of `Result` throughout codebase. Suggested-by: Miguel Ojeda <[email protected]> Link: Rust-for-Linux#1128 Signed-off-by: Manas <[email protected]> Signed-off-by: NipaLocal <nipa@local>
probe returns a `Result<()>` type, which can be simplified as `Result`, due to default type parameters being unit `()` and `Error` types. This maintains a consistent usage of `Result` throughout codebase. Suggested-by: Miguel Ojeda <[email protected]> Link: Rust-for-Linux#1128 Signed-off-by: Manas <[email protected]> Reviewed-by: Miguel Ojeda <[email protected]> Signed-off-by: NipaLocal <nipa@local>
probe returns a `Result<()>` type, which can be simplified as `Result`, due to default type parameters being unit `()` and `Error` types. This maintains a consistent usage of `Result` throughout codebase. Suggested-by: Miguel Ojeda <[email protected]> Link: Rust-for-Linux#1128 Signed-off-by: Manas <[email protected]> Reviewed-by: Miguel Ojeda <[email protected]> Signed-off-by: NipaLocal <nipa@local>
probe returns a `Result<()>` type, which can be simplified as `Result`, due to default type parameters being unit `()` and `Error` types. This maintains a consistent usage of `Result` throughout codebase. Suggested-by: Miguel Ojeda <[email protected]> Link: Rust-for-Linux#1128 Signed-off-by: Manas <[email protected]> Reviewed-by: Miguel Ojeda <[email protected]> Signed-off-by: NipaLocal <nipa@local>
`Result` is used in place of `Result<()>` because the default type parameters are unit `()` and `Error` types, which are automatically inferred. Thus keep the usage consistent throughout codebase. Suggested-by: Miguel Ojeda <[email protected]> Link: Rust-for-Linux#1128 Signed-off-by: Manas <[email protected]> Reviewed-by: Miguel Ojeda <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
probe returns a `Result<()>` type, which can be simplified as `Result`, due to default type parameters being unit `()` and `Error` types. This maintains a consistent usage of `Result` throughout codebase. Suggested-by: Miguel Ojeda <[email protected]> Link: Rust-for-Linux#1128 Signed-off-by: Manas <[email protected]>
This patch replaces `Result<()>` with `Result`. Suggested-by: Miguel Ojeda <[email protected]> Link: Rust-for-Linux#1128 Signed-off-by: Manas <[email protected]>
@ojeda I have the second patch for |
Sure, that could be useful -- but I would recommend making it clear that you are working on that, e.g. with a "Not-yet-Signed-off-by" tag or similar, or a note below the first Having said that, I think we are still waiting on the Thanks! |
There are 5 cases of
Result<()>
at the time of writing -- can they be simplified?Additionally, implement a
checkpatch.pl
check for it. This should be done in a different patch.Please note that the
checkpatch.pl
maintainers will need to agree to the change.This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and to add a
Suggested-by:
tag and aLink:
tag to this issue. Please see https://rust-for-linux.com/contributing for details.Please take this issue only if you are new to the kernel development process and you would like to use it as a test to submit your first patch to the kernel. Please do not take it if you do not plan to make other contributions to the kernel.
The text was updated successfully, but these errors were encountered: