code housekeeping

This commit is contained in:
りき萌 2025-08-26 12:46:50 +02:00
parent e1b6578b2a
commit d3c3ff8e4e
10 changed files with 108 additions and 100 deletions

View file

@ -232,7 +232,7 @@ impl SemaBranch {
diagnostics.push(
Diagnostic::warning()
.with_code("sema")
.with_message(format!("two branches share the same id `{}`", named_id))
.with_message(format!("two branches share the same id `{named_id}`"))
.with_labels(vec![
Label {
style: LabelStyle::Primary,
@ -345,23 +345,23 @@ impl SemaBranch {
}
// Check that link-type blocks are `+`-type to facilitate lazy loading.
if let Content::Link(_) = &attributes.content {
if branch.kind == BranchKind::Expanded {
diagnostics.push(Diagnostic {
severity: Severity::Warning,
code: Some("attr".into()),
message: "`content.link` branch is expanded by default".into(),
labels: vec![Label {
style: LabelStyle::Primary,
file_id,
range: branch.kind_span.clone(),
message: String::new(),
}],
notes: vec![
"note: `content.link` branches should normally be collapsed to allow for lazy loading".into(),
],
});
}
if let Content::Link(_) = &attributes.content
&& branch.kind == BranchKind::Expanded
{
diagnostics.push(Diagnostic {
severity: Severity::Warning,
code: Some("attr".into()),
message: "`content.link` branch is expanded by default".into(),
labels: vec![Label {
style: LabelStyle::Primary,
file_id,
range: branch.kind_span.clone(),
message: String::new(),
}],
notes: vec![
"note: `content.link` branches should normally be collapsed to allow for lazy loading".into(),
],
});
}
// Resolve content.links.