diff --git a/.circleci/config.yml b/.circleci/config.yml index 706a593..c45617a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ jobs: steps: - checkout - run: cargo --version - - run: cargo build + - run: cargo build --workspace - run: cargo test - run: name: Install tools @@ -30,8 +30,8 @@ jobs: steps: - checkout - run: cargo --version - - run: cargo build --features=css - - run: cargo test --features=css + - run: cargo build --features=css,css_ext --workspace + - run: cargo test --features=css,css_ext build-1-85: docker: - image: cimg/rust:1.85 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1908018..f5d7b3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ Possible log types: - `[fixed]` for any bug fixes. - `[security]` to invite users to upgrade in case of vulnerabilities. +### 0.17.0 + +- [changed] Split `html2text` example into `html2text-cli` crate +- [fixed] A possible panic when syntax-highlighting +- [changed] Update html5ever to 0.39.0 + ### 0.16.7 - [added] Support `` tags as bold (thanks amir) diff --git a/Cargo.lock b/Cargo.lock index f255873..9c34e12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,9 +28,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.21" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" dependencies = [ "anstyle", "anstyle-parse", @@ -43,15 +43,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" [[package]] name = "anstyle-parse" -version = "0.2.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" dependencies = [ "utf8parse", ] @@ -114,15 +114,15 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.10.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" [[package]] name = "cc" -version = "1.2.54" +version = "1.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6354c81bbfd62d9cfa9cb3c773c2b7b2a3a482d569de977fd0e961f6e7c00583" +checksum = "43c5703da9466b66a946814e1adf53ea2c90f10063b86290cc9eb67ce3478a20" dependencies = [ "find-msvc-tools", "shlex", @@ -136,9 +136,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "colorchoice" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" [[package]] name = "crc32fast" @@ -151,18 +151,18 @@ dependencies = [ [[package]] name = "deranged" -version = "0.5.5" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" dependencies = [ "powerfmt", ] [[package]] name = "env_filter" -version = "0.1.4" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" +checksum = "32e90c2accc4b07a8456ea0debdc2e7587bdd890680d71173a15d4ae604f6eef" dependencies = [ "log", "regex", @@ -170,9 +170,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.8" +version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +checksum = "0621c04f2196ac3f488dd583365b9c09be011a4ab8b9f37248ffcc8f6198b56a" dependencies = [ "anstream", "anstyle", @@ -189,21 +189,21 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "fastrand" -version = "2.3.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" [[package]] name = "find-msvc-tools" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "flate2" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" dependencies = [ "crc32fast", "miniz_oxide", @@ -223,13 +223,13 @@ checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" [[package]] name = "hashbrown" -version = "0.16.1" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" [[package]] name = "html2text" -version = "0.16.6" +version = "0.17.0" dependencies = [ "argparse", "backtrace", @@ -237,18 +237,28 @@ dependencies = [ "html5ever", "log", "nom", - "syntect", "tendril", "termion", "thiserror", "unicode-width", ] +[[package]] +name = "html2text-cli" +version = "0.17.0" +dependencies = [ + "argparse", + "html2text", + "log", + "syntect", + "termion", +] + [[package]] name = "html5ever" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1054432bae2f14e0061e33d23402fbaa67a921d319d56adc6bcf887ddad1cbc2" +checksum = "46a1761807faccc9a19e86944bbf40610014066306f96edcdedc2fb714bcb7b8" dependencies = [ "log", "markup5ever", @@ -256,9 +266,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.13.0" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", "hashbrown", @@ -272,15 +282,15 @@ checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "itoa" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "jiff" -version = "0.2.18" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +checksum = "1a3546dc96b6d42c5f24902af9e2538e82e39ad350b0c766eb3fbf2d8f3d8359" dependencies = [ "jiff-static", "log", @@ -291,9 +301,9 @@ dependencies = [ [[package]] name = "jiff-static" -version = "0.2.18" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +checksum = "2a8c8b344124222efd714b73bb41f8b5120b27a7cc1c75593a6ff768d9d05aa4" dependencies = [ "proc-macro2", "quote", @@ -302,9 +312,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.180" +version = "0.2.185" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" +checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f" [[package]] name = "linked-hash-map" @@ -329,9 +339,9 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "markup5ever" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8983d30f2915feeaaab2d6babdd6bc7e9ed1a00b66b5e6d74df19aa9c0e91862" +checksum = "7122d987ec5f704ee56f6e5b41a7d93722e9aae27ae07cafa4036c4d3f9757de" dependencies = [ "log", "tendril", @@ -340,9 +350,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.6" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "miniz_oxide" @@ -392,9 +402,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "once_cell_polyfill" @@ -488,9 +498,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.32" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" [[package]] name = "plist" @@ -507,15 +517,15 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "portable-atomic-util" -version = "0.2.4" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618" dependencies = [ "portable-atomic", ] @@ -552,9 +562,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.44" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] @@ -570,9 +580,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.12.2" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -582,9 +592,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", @@ -593,9 +603,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "rustc-demangle" @@ -668,9 +678,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "simd-adler32" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" [[package]] name = "siphasher" @@ -710,9 +720,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.114" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -813,9 +823,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-width" @@ -847,9 +857,9 @@ dependencies = [ [[package]] name = "web_atoms" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a9779e9f04d2ac1ce317aee707aa2f6b773afba7b931222bff6983843b1576" +checksum = "d7cff6eef815df1834fd250e3a2ff436044d82a9f1bc1980ca1dbdf07effc538" dependencies = [ "phf", "phf_codegen", @@ -892,6 +902,6 @@ dependencies = [ [[package]] name = "zmij" -version = "1.0.17" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02aae0f83f69aafc94776e879363e9771d7ecbffe2c7fbb6c14c5e00dfe88439" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml index db87bd4..0a2a01b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,20 +1,32 @@ [package] name = "html2text" -version = "0.16.7" -authors = ["Chris Emerson "] description = "Render HTML as plain text." -repository = "https://github.com/jugglerchris/rust-html2text/" readme = "README.md" documentation = "https://docs.rs/html2text/" -edition = "2024" -rust-version = "1.85" categories = ["text-processing"] - keywords = ["html", "text"] +version.workspace = true +repository.workspace = true +license.workspace = true +edition.workspace = true +rust-version.workspace = true + +[workspace] +members = [ + ".", + "html2text-cli", +] + +[workspace.package] +version = "0.17.0" +repository = "https://github.com/jugglerchris/rust-html2text/" license = "MIT" +authors = ["Chris Emerson "] +edition = "2024" +rust-version = "1.85" [dependencies] -html5ever = "0.38.0" +html5ever = "0.39.0" tendril = "0.5" unicode-width = "0.2" backtrace = { version = "0.3", optional=true } @@ -33,15 +45,10 @@ css_ext = ["css"] name = "html2term" path = "examples/html2term.rs" -[[example]] -name = "html2text" -path = "examples/html2text.rs" - [dev-dependencies] env_logger = "0.11.6" argparse = "0.2.2" log = "0.4.20" -syntect = "5.2.0" [target.'cfg(unix)'.dev-dependencies] termion = "4.0" diff --git a/README.md b/README.md index c3b067c..0052c4b 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ plain text (as in Rust `String`) or text spans with annotations like colours, e.g. optionally using CSS. See [the online demo](https://jugglerchris.github.io/rust-html2text/) for examples of the output. +`cargo install html2text-cli` will install the `html2text` CLI wrapper. + It makes use of the [Servo project](https://github.com/servo/servo)'s HTML parser, [html5ever](https://github.com/servo/html5ever/), using the DOM to generate text (which can optionally include annotations for some features such @@ -16,7 +18,7 @@ The project aims to do a reasonable job of rendering reasonable HTML in a terminal or other places where HTML needs to be converted to text (for example the text/plain fallback in HTML e-mails). -With features (see below) some CSS/colour support is available. +With feature flags enabled (see below) some CSS/colour support is available. ## Examples @@ -93,6 +95,7 @@ read keys from stdin. |Feature| Description| |-------|------------| |css | Limited handling of CSS, adding Coloured nodes to the render tree. | +|css\_ext| Some CSS extensions (see below for details) | |html\_trace| Add verbose internal logging (not recommended) | |html\_trace\_bt| Add backtraces to the verbose internal logging | @@ -110,10 +113,15 @@ Style rules are taken from: The following CSS features are implemented: * Basic selector matching (including child and descendents, classes and element types). +* Attribute selectors including `[foo]` and `[foo="bar"]` +* `nth-child` pseudo-class. * CSS colors (`color`/`background-color`) will add `Coloured(...)`/`BgColoured(...)` nodes to the render tree. * Rules with `display: none` will cause matching elements to be removed from - the render tree. + the render tree. The same is true if `overflow: hidden` or `overflow-y: hidden` and + the `height` or `max-height` are 0. +* `content: "text"` inside a `::before`/`::after` +* `white-space` values "normal", "pre", and "prewrap" The CSS handling is expected to improve in future (PRs welcome), but not to a full- blown browser style system, which would be overkill for terminal output. @@ -124,3 +132,15 @@ There are two ways to make use of the colours: * Use `from_read_coloured()`. This is similar to `from_read()`, but you provide a function to add terminal colours (or other styling) based on the same RichAnnotations. See examples/html2text.rs for an example using termion. + +### CSS extensions (`css\_ext` Cargo feature) + +The following CSS extensions are implemented: + +* `x-syntax: foo;` + - Syntax-highlight with language "foo". A highlighter needs to be registered + for that language with `config::register_highlighter()` - see the + `html2text-cli` for an example using `syntect`. +* `display: x-raw-dom;` + - Show the HTML elements instead of rendering them. (Useful for debugging, along + with something like `:nth-child(...)` to select a particular node) diff --git a/html2text-cli/Cargo.toml b/html2text-cli/Cargo.toml new file mode 100644 index 0000000..7d5e298 --- /dev/null +++ b/html2text-cli/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name = "html2text-cli" +description = "Render HTML as plain text." +readme = "README.md" +categories = ["text-processing"] +keywords = ["html", "text"] +default-run = "html2text" +version.workspace = true +repository.workspace = true +license.workspace = true +edition.workspace = true +rust-version.workspace = true + +[[bin]] +name = "html2text" +path = "src/main.rs" + +[dependencies] +html2text = { version = "0.17.0", path = ".." } +argparse = "0.2.2" +log = "0.4.20" +syntect = "5.2.0" + +[target.'cfg(unix)'.dependencies] +termion = "4.0" + +[features] +default = ["css"] +css = ["html2text/css"] +css_ext = ["html2text/css_ext"] +html_trace = ["html2text/html_trace"] +html_trace_btr = ["html2text/html_trace_bt"] diff --git a/html2text-cli/README.md b/html2text-cli/README.md new file mode 100644 index 0000000..cc6c7b8 --- /dev/null +++ b/html2text-cli/README.md @@ -0,0 +1,20 @@ +# html2text + +A command-line tool to convert HTML into text in various forms. Supports some +CSS including colours with default features. + +The default, which gives text with ASCII annotations similar to (but not +exactly) markdown for things like `` elements and lists, and table +formatting. It defaults to reading from standard input and writing to standard +output. + +```sh +html2text foo.html +``` + +For a more fancy terminal output, including ANSI colours, syntax highlighting +using syntect (`css_ext` cargo feature required) and added CSS rules: + +```sh +html2text --colour --css --syntax --agent-css 'pre.rust { x-syntax: rs; }' < file_with_rust_code.html +``` diff --git a/examples/html2text.rs b/html2text-cli/src/main.rs similarity index 100% rename from examples/html2text.rs rename to html2text-cli/src/main.rs diff --git a/src/lib.rs b/src/lib.rs index 48d798d..b01cb6f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1581,13 +1581,14 @@ impl RenderInput { // in the next run of the outer loop; hence allowing // clippy::mut_range_bound on the function. start_style_index = es_idx; - } - // This piece must overlap! - // Clip the range to this node. - style_range.start = style_range.start.max(offset) - offset; - style_range.end = style_range.end.min(end_offset) - offset; + } else { + // This piece must overlap! + // Clip the range to this node. + style_range.start = style_range.start.max(offset) - offset; + style_range.end = style_range.end.min(end_offset) - offset; - child_extra_styles.push((style_range, extra_styles[es_idx].1.clone())); + child_extra_styles.push((style_range, extra_styles[es_idx].1.clone())); + } } result.push(RenderInput { handle: Rc::clone(child), @@ -2045,7 +2046,7 @@ fn process_dom_node( } Finished(RenderNode::new_styled( - Svg(title.unwrap_or_else(|| String::new())), + Svg(title.unwrap_or_else(String::new)), computed, )) }