Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions html5ever/src/serialize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn tagname(name: &QualName) -> LocalName {
ns!(html) | ns!(mathml) | ns!(svg) => (),
ref ns => {
// FIXME(#122)
warn!("node with weird namespace {:?}", ns);
warn!("node with weird namespace {ns:?}");
},
}

Expand Down Expand Up @@ -150,7 +150,7 @@ impl<Wr: Write> Serializer for HtmlSerializer<Wr> {
ns!(xlink) => self.writer.write_all(b"xlink:")?,
ref ns => {
// FIXME(#122)
warn!("attr with weird namespace {:?}", ns);
warn!("attr with weird namespace {ns:?}");
self.writer.write_all(b"unknown_namespace:")?;
},
}
Expand Down
6 changes: 3 additions & 3 deletions html5ever/src/tokenizer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ impl<Sink: TokenSink> Tokenizer<Sink> {
self.emit_error(Cow::Owned(msg));
}

trace!("got character {}", c);
trace!("got character {c}");
self.current_char.set(c);
Some(c)
}
Expand Down Expand Up @@ -298,7 +298,7 @@ impl<Sink: TokenSink> Tokenizer<Sink> {
}

let d = input.pop_except_from(set);
trace!("got characters {:?}", d);
trace!("got characters {d:?}");
match d {
Some(FromSet(c)) => self.get_preprocessed_char(c, input).map(FromSet),

Expand Down Expand Up @@ -542,7 +542,7 @@ impl<Sink: TokenSink> Tokenizer<Sink> {
self.process_token_and_continue(DoctypeToken(doctype));
}

fn doctype_id(&self, kind: DoctypeIdKind) -> RefMut<Option<StrTendril>> {
fn doctype_id(&self, kind: DoctypeIdKind) -> RefMut<'_, Option<StrTendril>> {
let current_doctype = self.current_doctype.borrow_mut();
match kind {
Public => RefMut::map(current_doctype, |d| &mut d.public_id),
Expand Down
8 changes: 4 additions & 4 deletions html5ever/src/tree_builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,13 +672,13 @@ where
}
//§ END

fn current_node(&self) -> Ref<Handle> {
fn current_node(&self) -> Ref<'_, Handle> {
Ref::map(self.open_elems.borrow(), |elems| {
elems.last().expect("no current element")
})
}

fn adjusted_current_node(&self) -> Ref<Handle> {
fn adjusted_current_node(&self) -> Ref<'_, Handle> {
if self.open_elems.borrow().len() == 1 {
let context_elem = self.context_elem.borrow();
let ctx = Ref::filter_map(context_elem, |e| e.as_ref());
Expand Down Expand Up @@ -1022,12 +1022,12 @@ where
}

/// Get the first element on the stack, which will be the <html> element.
fn html_elem(&self) -> Ref<Handle> {
fn html_elem(&self) -> Ref<'_, Handle> {
Ref::map(self.open_elems.borrow(), |elems| &elems[0])
}

/// Get the second element on the stack, if it's a HTML body element.
fn body_elem(&self) -> Option<Ref<Handle>> {
fn body_elem(&self) -> Option<Ref<'_, Handle>> {
if self.open_elems.borrow().len() <= 1 {
return None;
}
Expand Down
2 changes: 1 addition & 1 deletion markup5ever/interface/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ impl QualName {
/// ```
///
#[inline]
pub fn expanded(&self) -> ExpandedName {
pub fn expanded(&self) -> ExpandedName<'_> {
ExpandedName {
ns: &self.ns,
local: &self.local,
Expand Down
2 changes: 1 addition & 1 deletion markup5ever/interface/tree_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub trait ElemName: Debug {
fn local_name(&self) -> &LocalName;

#[inline(always)]
fn expanded(&self) -> ExpandedName {
fn expanded(&self) -> ExpandedName<'_> {
ExpandedName {
ns: self.ns(),
local: self.local_name(),
Expand Down
2 changes: 1 addition & 1 deletion markup5ever/util/buffer_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ impl BufferQueue {
}

/// Return a mutable reference to the first tendril in the queue.
pub fn peek_front_chunk_mut(&self) -> Option<RefMut<StrTendril>> {
pub fn peek_front_chunk_mut(&self) -> Option<RefMut<'_, StrTendril>> {
let buffers = self.buffers.borrow_mut();
if buffers.is_empty() {
return None;
Expand Down
10 changes: 5 additions & 5 deletions xml5ever/src/tokenizer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl<Sink: TokenSink> XmlTokenizer<Sink> {
self.emit_error(Cow::Owned(msg));
}

debug!("got character {}", c);
debug!("got character {c}");
self.current_char.set(c);
Some(c)
}
Expand All @@ -286,7 +286,7 @@ impl<Sink: TokenSink> XmlTokenizer<Sink> {
}

let d = input.pop_except_from(set);
debug!("got characters {:?}", d);
debug!("got characters {d:?}");
match d {
Some(FromSet(c)) => self.get_preprocessed_char(c, input).map(FromSet),

Expand Down Expand Up @@ -493,7 +493,7 @@ impl<Sink: TokenSink> XmlTokenizer<Sink> {
self.process_token(DoctypeToken(doctype));
}

fn doctype_id(&self, kind: DoctypeKind) -> RefMut<Option<StrTendril>> {
fn doctype_id(&self, kind: DoctypeKind) -> RefMut<'_, Option<StrTendril>> {
let current_doctype = self.current_doctype.borrow_mut();
match kind {
Public => RefMut::map(current_doctype, |d| &mut d.public_id),
Expand Down Expand Up @@ -1148,11 +1148,11 @@ impl<Sink: TokenSink> XmlTokenizer<Sink> {
"\n{:12} total in token sink",
self.time_in_sink.get()
);
debug!("\n{:12} total in tokenizer", total);
debug!("\n{total:12} total in tokenizer");

for (k, v) in results.into_iter() {
let pct = 100.0 * (v as f64) / (total as f64);
debug!("{:12} {:4.1}% {:?}", v, pct, k);
debug!("{v:12} {pct:4.1}% {k:?}");
}
}

Expand Down
2 changes: 1 addition & 1 deletion xml5ever/src/tokenizer/qname.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct QualNameTokenizer<'a> {
}

impl QualNameTokenizer<'_> {
pub fn new(tag: &[u8]) -> QualNameTokenizer {
pub fn new(tag: &[u8]) -> QualNameTokenizer<'_> {
QualNameTokenizer {
state: QualNameState::BeforeName,
slice: tag,
Expand Down
6 changes: 3 additions & 3 deletions xml5ever/src/tree_builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl NamespaceMap {
}

#[doc(hidden)]
pub fn get_scope_iter(&self) -> Iter<Option<Prefix>, Option<Namespace>> {
pub fn get_scope_iter(&self) -> Iter<'_, Option<Prefix>, Option<Namespace>> {
self.scope.iter()
}

Expand Down Expand Up @@ -234,7 +234,7 @@ where
#[cfg(not(for_c))]
#[allow(dead_code)]
fn dump_state(&self, label: String) {
debug!("dump_state on {}", label);
debug!("dump_state on {label}");
debug!(" open_elems:");
for node in self.open_elems.borrow().iter() {
debug!(" {:?}", self.sink.elem_name(node));
Expand Down Expand Up @@ -444,7 +444,7 @@ where
Handle: Clone,
Sink: TreeSink<Handle = Handle>,
{
fn current_node(&self) -> Ref<Handle> {
fn current_node(&self) -> Ref<'_, Handle> {
Ref::map(self.open_elems.borrow(), |elems| {
elems.last().expect("no current element")
})
Expand Down