Throwaway self ref without custom receiver

I want to be able to have a method with a throwaway self reference. Is there a way to do the following:

struct Foo;

impl Foo {
    fn throwaway_self_ref(&_self) {}
}

This one doesn't work; it wants a type after self and doesn't like the &.

This one compiles but the method becomes an associated function, and can't be called with dot notation:

impl Foo {
    fn throwaway_self_ref(_self: &Self) {}
    fn bar(&self) {
        // fails
        self.throwaway_self_ref();
    }
}

Is there a way to do this? Would it make sense to make an exception for the self behavior for _self? Is that something that would get introduced at an edition boundary?

If you're just worried about "unused" warnings, &self is already exempt -- e.g. warning-free playground.

3 Likes

Well oops. Thanks.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.