IntelliJ Rust "Basic Techniques"?

  1. I recently discovered the power of “GotoClass” action in IntelliJ/Rust. In a workspace with ~20 crates and ~20,000 LOC, I now no longer hunt for crate/src/foo/bar/blah.rs . Instead, it’s just “GotoClass”, start auto compete on struct/enum name, and IntelliJ jumps me to the right place.

  2. This has drastically changed my Rust workflow.

  3. Is there a list of “IntelliJ/Rust” “basic techniques” somewhere out there? I feel like there’s a lot of workflow mods that could drastically increase my IntelliJ/Rust productivity.

Shift-Shift opens a fuzzy file finder.

Live templates. I have it set up so that display<Enter> inserts

impl fmt::Display for | {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

    }
}
1 Like

Any other case you use LiveTemplates for? For the Display example, my current technique would be:

impl fmt::Display for FooBar {<CR>

up arrow, (red squiggly appears), alt-enter -> insert missing functions -> it generates the “fn fmt” automatically based on the trait

Actually, better question would be: is your set of live templates online anywhere?

Heh. Nope, actually just Display! So many things want to impl Display, from Error types to AST types to newtype wrappers. And I forgot that the live template existed for a good long time, but I finally remembered about it earlier today and it saved me a fair bit of grief.

I should probably use one for eprintln!("{:?}", x) since it’s such an obstacle course for the hands. (I don’t like the output of dbg!(x); wastes too much space)