Repository: rust-lang/rust-mode (language: rust)

Issue:
Cannot setup LSP formatting and treesitter together
Hello,

Here is my current config:

```elisp
(use-package rust-mode
  :hook (rust-mode . lsp-deferred)
  :init
  (setq rust-mode-treesitter-derive t)
  :config
  (setq rust-format-on-save t
        rust-after-save-method 'lsp-format-buffer))
```

Then in rust-mode (when editing a Rust file), the format on save is not happening.

Strangely, it says:
```
run-hooks: Symbol’s function definition is void: rust-after-save-method
```
I keep having the same message if I try too change what is in the `:init` and `:config` statements.



Discussion / hints:
I have the same issue and I even don't config the `rust-format-on-save`. I found the `rust-after-save-hook` is `rust-after-save-method`. Looks like #515 move `rust-after-save-hook` to `rust-common.el`, and the `rust-after-save-method` actually in [rust-rustfmt.el](https://github.com/rust-lang/rust-mode/blob/ade453f95e95a3fb6ae90204e51571008fd25d48/rust-rustfmt.el#L365). 

Does `rust-common.el` forgot import the `rust-format`? 
> Does rust-common.el forgot import the rust-format?

You're right. Does this PR make it work: https://github.com/rust-lang/rust-mode/pull/517 ?
@psibi Unfortunately, it doesn't, I try add `rust-rustfmt` in `rust-common` and it fixed on my side. 

```diff
modified   rust-common.el
@@ -4,6 +4,8 @@
 ;; rust-common code for both prog-mode and tree-sitter one
 
 ;;; Code:
+(require 'rust-rustfmt)
+
 (defcustom rust-before-save-hook 'rust-before-save-method
   "Function for formatting before save."
   :type 'function

```
@ccqpein Cool, want to send a PR with your changes ?

Fix patch:
diff --git a/rust-common.el b/rust-common.el
index c216264..b7dd695 100644
--- a/rust-common.el
+++ b/rust-common.el
@@ -4,6 +4,8 @@
 ;; rust-common code for both prog-mode and tree-sitter one
 
 ;;; Code:
+(require 'rust-rustfmt)
+
 (defcustom rust-before-save-hook 'rust-before-save-method
   "Function for formatting before save."
   :type 'function


Test patch: