Input {:?} quickly in vim

Add this line into your vimrc:

autocmd FileType rust inoremap <leader>d {:?}

In vim insert mode, if you try \d, vim will convert that into {:?}.

Find out the type name of specific variable when debugging

Add this line to your code

let a: () = var;

You will got compile failure with type name of your variable.

Speed up the compiling with lld linker

In Fedora/RHEL/CentOS, you may:

  • Add this to you .bashrc: export RUSTFLAGS="-C link-arg=-fuse-ld=lld"
  • Install lld: sudo dnf install lld -y