6010: Avoid checking all ancestors and fix mis-completion r=jonas-schievink a=oxalica
Refactor the logic of `completion_match` to check deterministic number of ancestors instead of `token.ancestors().find_map()`.
This should fix wrong completions (https://github.com/rust-analyzer/rust-analyzer/pull/5976#issuecomment-
692332191) and hopefully make completion to be faster (#6004).
More play and test? @jonas-schievink @hammypants
If this patch works, we can avoid the revert #6005 . :disappointed:
Co-authored-by: oxalica <oxalicc@pm.me>