aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-12-03 10:07:22 +0100
committerMartin Fischer <martin@push-f.com>2021-12-05 02:52:36 +0100
commit0b32dce1dad570268a641e07c003913bdde4c54e (patch)
tree81003701f2a20ed11749377ab816785f137b382d
parent2c5284aacb91e5d3aaa729f4319e368296b1d47d (diff)
improve duplicate attribute span
-rw-r--r--src/spans.rs5
-rw-r--r--tests/span-tests/demo.out2
2 files changed, 3 insertions, 4 deletions
diff --git a/src/spans.rs b/src/spans.rs
index ac87751..2107f20 100644
--- a/src/spans.rs
+++ b/src/spans.rs
@@ -93,9 +93,8 @@ impl<R: GetPos> SpanEmitter<R> {
Entry::Vacant(vacant) => {
vacant.insert(v);
}
- Entry::Occupied(occupied) => {
- let span = occupied.get().name_span.clone();
- self.emit_error_span(Error::DuplicateAttribute, span);
+ Entry::Occupied(_) => {
+ self.emit_error_span(Error::DuplicateAttribute, v.name_span);
}
},
Some(Token::EndTag(_)) => {
diff --git a/tests/span-tests/demo.out b/tests/span-tests/demo.out
index 37ab8be..22513f7 100644
--- a/tests/span-tests/demo.out
+++ b/tests/span-tests/demo.out
@@ -23,7 +23,7 @@ note:
│ ^ unknown-named-character-reference
12 │
13 │ Does this open two pages? <a href=foo.html href=bar.html>click me</a>
- │ ^^^^ duplicate-attribute
+ │ ^^^^ duplicate-attribute
14 │
15 │ Do you start or do you end? </yes/>
│ ^ end-tag-with-trailing-solidus