mod macros;
mod display_source_code;
mod incremental;
+mod diagnostics;
use std::{collections::HashMap, env, sync::Arc};
use once_cell::race::OnceBool;
use stdx::format_to;
use syntax::{
- ast::{self, AstNode, NameOwner},
+ ast::{self, AstNode, HasName},
SyntaxNode,
};
use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Registry};
.trim_start_matches("adjustments: ")
.split(',')
.map(|it| it.trim().to_string())
+ .filter(|it| !it.is_empty())
.collect(),
);
} else {
mismatch.expected.display_test(&db),
mismatch.actual.display_test(&db)
);
- if let Some(annotation) = mismatches.remove(&range) {
- assert_eq!(actual, annotation);
- } else {
- format_to!(unexpected_type_mismatches, "{:?}: {}\n", range.range, actual);
+ match mismatches.remove(&range) {
+ Some(annotation) => assert_eq!(actual, annotation),
+ None => format_to!(unexpected_type_mismatches, "{:?}: {}\n", range.range, actual),
}
}
for (expr, mismatch) in inference_result.expr_type_mismatches() {
mismatch.expected.display_test(&db),
mismatch.actual.display_test(&db)
);
- if let Some(annotation) = mismatches.remove(&range) {
- assert_eq!(actual, annotation);
- } else {
- format_to!(unexpected_type_mismatches, "{:?}: {}\n", range.range, actual);
+ match mismatches.remove(&range) {
+ Some(annotation) => assert_eq!(actual, annotation),
+ None => format_to!(unexpected_type_mismatches, "{:?}: {}\n", range.range, actual),
}
}
}
let (range, text) = if let Some(self_param) = ast::SelfParam::cast(node.value.clone()) {
(self_param.name().unwrap().syntax().text_range(), "self".to_string())
} else {
- (node.value.text_range(), node.value.text().to_string().replace("\n", " "))
+ (node.value.text_range(), node.value.text().to_string().replace('\n', " "))
};
let macro_prefix = if node.file_id != file_id.into() { "!" } else { "" };
format_to!(