mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Make always-assert crate reusable
This commit is contained in:
parent
2664aee8e5
commit
d35bda6429
11 changed files with 24 additions and 73 deletions
|
@ -10,7 +10,7 @@ use std::{
|
|||
|
||||
use base_db::{AnchoredPathBuf, FileId};
|
||||
use rustc_hash::FxHashMap;
|
||||
use stdx::assert_never;
|
||||
use stdx::never;
|
||||
use text_edit::TextEdit;
|
||||
|
||||
#[derive(Default, Debug, Clone)]
|
||||
|
@ -40,10 +40,7 @@ impl SourceChange {
|
|||
pub fn insert_source_edit(&mut self, file_id: FileId, edit: TextEdit) {
|
||||
match self.source_file_edits.entry(file_id) {
|
||||
Entry::Occupied(mut entry) => {
|
||||
assert_never!(
|
||||
entry.get_mut().union(edit).is_err(),
|
||||
"overlapping edits for same file"
|
||||
);
|
||||
never!(entry.get_mut().union(edit).is_err(), "overlapping edits for same file");
|
||||
}
|
||||
Entry::Vacant(entry) => {
|
||||
entry.insert(edit);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue