]>
git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/result_unit_error.rs
1 #![warn(clippy::result_unit_err)]
3 pub fn returns_unit_error() -> Result
<u32, ()> {
7 fn private_unit_errors() -> Result
<String
, ()> {
11 pub trait HasUnitError
{
12 fn get_that_error(&self) -> Result
<bool
, ()>;
14 fn get_this_one_too(&self) -> Result
<bool
, ()> {
19 impl HasUnitError
for () {
20 fn get_that_error(&self) -> Result
<bool
, ()> {
25 trait PrivateUnitError
{
26 fn no_problem(&self) -> Result
<usize, ()>;
29 pub struct UnitErrorHolder
;
31 impl UnitErrorHolder
{
32 pub fn unit_error(&self) -> Result
<usize, ()> {
37 // https://github.com/rust-lang/rust-clippy/issues/6546
39 type ResInv
<A
, B
> = Result
<B
, A
>;
41 pub fn should_lint() -> ResInv
<(), usize> {
45 pub fn should_not_lint() -> ResInv
<usize, ()> {
49 type MyRes
<A
, B
> = Result
<(A
, B
), Box
<dyn std
::error
::Error
>>;
51 pub fn should_not_lint2(x
: i32) -> MyRes
<i32, ()> {