Skip to content
Merged

Bump #282

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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v2.6.0

- Added source code locations to the C and JS APIs
- Significant performance improvements and code size reductions

## v2.5.0

- Source code locations for tags and other tokens.
Expand Down
22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lol_html"
version = "2.5.0"
version = "2.6.0"
authors = ["Ivan Nikulin <[email protected], [email protected]>"]
license = "BSD-3-Clause"
description = "Streaming HTML rewriter/parser with CSS selector-based API"
Expand Down Expand Up @@ -32,21 +32,21 @@ bitflags = "2.9.1"
cfg-if = "1.0.1"
cssparser = "0.35"
encoding_rs = "0.8.35"
hashbrown = "0.15.3"
memchr = "2.7.4"
mime = "0.3.16"
selectors = "0.27"
hashbrown = "0.15.4"
memchr = "2.7.5"
mime = "0.3.17"
selectors = "0.30"
thiserror = "2.0"
precomputed-hash = "0.1.1"

[dev-dependencies]
criterion = "0.5.1"
criterion = "0.6.0"
# Needed for criterion <= v0.5.1. See https://github.com/bheisler/criterion.rs/pull/703.
clap = { version = "4.5.21", features = ["help"] }
glob = "0.3.0"
html5ever = "0.29"
markup5ever_rcdom = "0.5.0-unofficial"
hashbrown = { version = "0.15.0", features = ["serde"] }
clap = { version = "4.5.41", features = ["help"] }
glob = "0.3.2"
html5ever = "0.35"
markup5ever_rcdom = "0.35.0"
hashbrown = { version = "0.15.4", features = ["serde"] }
serde = "1.0.219"
serde_derive = "1.0.219"
serde_json = "1.0.140"
Expand Down
4 changes: 2 additions & 2 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ macro_rules! create_runner {
move |b, i: &Vec<Vec<u8>>| {
b.iter(|| {
let mut rewriter = lol_html::HtmlRewriter::new($settings, |c: &[u8]| {
black_box(c);
std::hint::black_box(c);
});

for chunk in i {
Expand All @@ -63,7 +63,7 @@ macro_rules! create_runner {
macro_rules! noop_handler {
() => {
|arg| {
black_box(arg);
std::hint::black_box(arg);
Ok(())
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/base/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::str;

/// An error used to indicate that an encoded string has replacements and can't be converted losslessly.
#[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
#[allow(unnameable_types, reason = "accidentally exposed via `tag.set_name()`")]
#[allow(unnameable_types)] // accidentally exposed via `tag.set_name()`
pub struct HasReplacementsError;

/// A thin wrapper around byte slice with handy APIs attached
Expand All @@ -17,7 +17,7 @@ pub(crate) struct Bytes<'b>(&'b [u8]);

/// A thin wrapper around either byte slice or owned bytes with some handy APIs attached
#[derive(Clone, PartialEq, Eq, Hash)]
#[allow(unnameable_types, reason = "accidentally exposed via `tag.set_name()`")]
#[allow(unnameable_types)] // accidentally exposed via `tag.set_name()`
#[repr(transparent)]
pub struct BytesCow<'b>(Cow<'b, [u8]>);

Expand Down
2 changes: 1 addition & 1 deletion src/html/text_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ cfg_if! {
}
}

#[allow(clippy::fallible_impl_from)]
impl<'s> From<&'s str> for TextType {
#[allow(clippy::fallible_impl_from)]
fn from(text_type: &'s str) -> Self {
match text_type {
"Data state" => Self::Data,
Expand Down
1 change: 1 addition & 0 deletions src/memory/limited_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ impl<T> LimitedVec<T> {
}

pub fn push(&mut self, element: T) -> Result<(), MemoryLimitExceededError> {
#[allow(clippy::branches_sharing_code)]
if self.vec.capacity() - self.vec.len() >= 1 {
// the two push calls are optimized into one, but need to be two so each gets its own capacity hint
self.vec.push(element);
Expand Down
4 changes: 2 additions & 2 deletions src/selectors_vm/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ impl From<&Component<SelectorImplDescriptor>> for Condition {
),
)),
Component::Nth(data) if data.ty == NthType::Child => {
Self::OnTagName(OnTagNameExpr::NthChild(NthChild::new(data.a, data.b)))
Self::OnTagName(OnTagNameExpr::NthChild(NthChild::new(data.an_plus_b.0, data.an_plus_b.1)))
}
Component::Nth(data) if data.ty == NthType::OfType => {
Self::OnTagName(OnTagNameExpr::NthOfType(NthChild::new(data.a, data.b)))
Self::OnTagName(OnTagNameExpr::NthOfType(NthChild::new(data.an_plus_b.0, data.an_plus_b.1)))
}
// NOTE: the rest of the components are explicit namespace or
// pseudo class-related. Ideally none of them should appear in
Expand Down
2 changes: 1 addition & 1 deletion src/transform_stream/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ where
} => {
get_flags_from_aux_info_res!(aux_info_req, &attributes, self_closing)
}
_ => Err(ActionError::internal(
TagTokenOutline::EndTag { .. } => Err(ActionError::internal(
"Tag should be a start tag at this point",
)),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use hashbrown::HashMap;
use html5ever::tendril::StrTendril;
use html5ever::tokenizer::{
BufferQueue, TagKind, Token, TokenSink, TokenSinkResult, Tokenizer, TokenizerOpts,
TokenizerResult,
};
use html5ever::tree_builder::{TreeBuilder, TreeBuilderOpts};
use html5ever::TokenizerResult;
use markup5ever_rcdom::RcDom;
use std::cell::RefCell;
use std::iter::FromIterator;
Expand Down