Input {:?} quickly in vim

Add this line into your vimrc:

1
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

1
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