mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Merge #3395
3395: Tighten up an assert r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
f40ed3fcb0
@ -184,6 +184,10 @@ pub fn handle_on_type_formatting(
|
||||
// `text.char_at(position) == typed_char`.
|
||||
position.offset -= TextUnit::of_char('.');
|
||||
let char_typed = params.ch.chars().next().unwrap_or('\0');
|
||||
assert!({
|
||||
let text = world.analysis().file_text(position.file_id)?;
|
||||
text[position.offset.to_usize()..].starts_with(char_typed)
|
||||
});
|
||||
|
||||
// We have an assist that inserts ` ` after typing `->` in `fn foo() ->{`,
|
||||
// but it requires precise cursor positioning to work, and one can't
|
||||
|
Loading…
Reference in New Issue
Block a user