diff options
author | Martin Fischer <martin@push-f.com> | 2023-09-27 08:05:58 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-09-28 10:36:08 +0200 |
commit | 3c89744824ea6b8b32d82c2c37ac1de6d980709c (patch) | |
tree | f09c32d629507af4ae99b05bd9629cffeba879bc /src/tracing_emitter.rs | |
parent | c75dce875cff03e59ec7b6bceed4ec63283a6477 (diff) |
break!: make AttributeMap::get return Option<&str>
Most of the time you'll only be interested in the attribute value,
so the `get` method should directly return it instead of a wrapper type.
This also makes the API more predictable since e.g. the DOM getAttribute
method also returns a string. Lastly previously it was quite confusing
that map[key] wasn't equivalent to map.get(key).unwrap().
Diffstat (limited to 'src/tracing_emitter.rs')
-rw-r--r-- | src/tracing_emitter.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tracing_emitter.rs b/src/tracing_emitter.rs index 21f40f7..9591839 100644 --- a/src/tracing_emitter.rs +++ b/src/tracing_emitter.rs @@ -365,7 +365,10 @@ mod tests { ("single-quoted", Some(AttrValueSyntax::SingleQuoted)), ("double-quoted", Some(AttrValueSyntax::DoubleQuoted)), ] { - let attr_trace_idx = tag.attributes.get(name).unwrap().trace_idx().unwrap(); + let (_, Some(attr_trace_idx)) = tag.attributes.value_and_trace_idx(name).unwrap() + else { + panic!() + }; assert_eq!( tag_trace.attribute_traces[attr_trace_idx].value_syntax(), syntax, |