Print runnable kind on assertion failure for better debuggability

This commit is contained in:
Lukas Wirth 2021-07-02 15:28:38 +02:00
parent f640f2dbb4
commit 0b8e145641

View file

@ -105,10 +105,12 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> {
let mut res = Vec::new(); let mut res = Vec::new();
let mut add_opt = |runnable: Option<Runnable>| { let mut add_opt = |runnable: Option<Runnable>| {
if let Some(runnable) = runnable.filter(|r| { if let Some(runnable) = runnable.filter(|runnable| {
always!( always!(
r.nav.file_id == file_id, runnable.nav.file_id == file_id,
"tried adding a runnable pointing to a different file" "tried adding a runnable pointing to a different file: {:?} for {:?}",
runnable.kind,
file_id
) )
}) { }) {
res.push(runnable); res.push(runnable);