From 65aca9cbf0318bd3a2f936641b4f5bc3729c98c2 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Wed, 16 Aug 2023 09:45:18 +0200 Subject: break!: introduce AttributeMap This has a number of benefits: * it hides the implementation of the map * it hides the type used for the map values (which lets us e.g. change name_span to name_offset while still being able to provide a convenient `Attribute::name_span` method.) * it lets us provide convenience impls for the map such as `FromIterator<(String, String)>` --- tests/test_spans.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/test_spans.rs b/tests/test_spans.rs index 33f5d11..99ff9ee 100644 --- a/tests/test_spans.rs +++ b/tests/test_spans.rs @@ -110,8 +110,8 @@ fn attribute_name_span() { let Token::StartTag(tag) = tokenizer(html).next().unwrap() else { panic!("expected start tag") }; - for (_name, attr) in tag.attributes { - labels.push((attr.name_span, "")); + for attr in &tag.attributes { + labels.push((attr.name_span(), "")); } assert_snapshot!(annotate(html, labels), @r###" @@ -126,8 +126,8 @@ fn attribute_value_span() { let Token::StartTag(tag) = tokenizer(html).next().unwrap() else { panic!("expected start tag") }; - for (_name, attr) in tag.attributes { - labels.push((attr.value_span, "")); + for attr in &tag.attributes { + labels.push((attr.value_span(), "")); } assert_snapshot!(annotate(html, labels), @r###" -- cgit v1.2.3