IntelliJ Rust Profile picture
Nov 1 7 tweets 5 min read
It’s hard to overstate the importance of refactoring your code. When done right, refactoring can reduce complexity and make your code more readable and easier to maintain.

In this thread 🧵 we'll show you some nifty refactorings in IntelliJ Rust.

👉 plugins.jetbrains.com/plugin/8182-ru…
The most important shortcut for working with refactorings in JetBrains IDEs is ⌃T, or Ctrl+Alt+Shift+T for Windows/Linux. It brings up the ‘Refactor this’ menu where you can simply choose the refactoring you need from the list.

plugins.jetbrains.com/plugin/8182-ru… #rustlang Image
One of the most frequently used refactorings is ‘Rename’. It renames any symbol and automatically corrects all its references in your code. Just place the caret on a symbol and press ⇧F6 / Shift+F6 to begin renaming.

plugins.jetbrains.com/plugin/8182-ru… #rustlang
The ‘Move’ refactoring (F6) can help you move top-level items within your project. Like with all other refactoring methods, the IDE will correct all the references automatically to ensure the modifications do not break your code.

plugins.jetbrains.com/plugin/8182-ru… #rustlang
If you need to move a single file, just drag and drop it and the ‘Move’ refactoring will do the rest! This process also supports re-exports.

plugins.jetbrains.com/plugin/8182-ru… #rustlang
‘Introduce Variable’ puts the result of an expression into a variable. Select the expression and press ⌥⌘V / Ctrl+Alt+V to replace it with the new variable.

‘Inline’ (⌥⌘N / Ctrl+Alt+N) does the opposite.

plugins.jetbrains.com/plugin/8182-ru… #rustlang
With the ‘Extract Method’ refactoring (⌥⌘M / Ctrl+Alt+M), you can take a code fragment, move it into a separate method, and replace the old code with a call to the method.

‘Inline’ (⌥⌘N / Ctrl+Alt+N) does the opposite.

plugins.jetbrains.com/plugin/8182-ru… #rustlang

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with IntelliJ Rust

IntelliJ Rust Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(