IntelliJ: jump to "impl trait for struct/enum?

Suppose we have trait Some_Trait and struct Car, what is the best way to jump to "impl Some_Trait for Car" ? (in the workspace, might be different crate).

The best I have so far is to do a workspace wide regex search with query

impl .* Some_Trait.* for .*Car

but I'm wondering if there is a better way.

Jumping to a trait is easy. Jumping to a struct/enum is easy, but jumping to a combination of the two -- as far as I can see so far, is a regex search (and hope it's on the same line) ?

1 Like

I don't know any specialized way to jump specifically to the "impl T for X" location. :thinking:

The way I usually do a similar thing is through the "🇮↓" gutter icon near the trait's definition - it shows a popup of all implementations (in other crates and all the dependencies too) to conveniently choose from:


(side note: fyi that there's a forum category for ide-related questions: https://users.rust-lang.org/c/ide)

1 Like

One trick to answer some subset of these kind of questions is to consult the pdf with shortcuts:

It doesn’t contain everything, but it has important things.

In this case, that would be “go to implementation” under “navigation”.

1 Like

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.