]> git.lizzy.rs Git - rust.git/commit
Make code more understandable
authorAleksey Kladov <aleksey.kladov@gmail.com>
Wed, 23 Dec 2020 10:16:24 +0000 (13:16 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Wed, 23 Dec 2020 10:16:24 +0000 (13:16 +0300)
commit3ced546033973a63cb2ef1644ca099740fdfb1c2
tree7c38c6204afc8faa7f9b2ede6e6d5ffe73f8b80f
parente1aca75974d917755c04e5040100dfb6ae92f2f9
Make code more understandable

Avoid mutation of snapshot's config -- that's spooky action at a
distance. Instead, copy it over to a local variable.

This points out a minor architecture problem, which we won't fix right
away.

Various `ide`-level config structs, like `AssistConfig`, are geared
towards one-shot use when calling a specific methods. On the other
hand, the large `Config` struct in `rust-analyzer` is a long-term
config store.

The fact that `Config` stores `AssistConfig` is accidental -- a better
design would probably be to just store `ConfigData` inside `Config`
and create various `Config`s on the fly out of it.
crates/rust-analyzer/src/handlers.rs