Skip to content

Commit 4601d0f

Browse files
authored
Merge pull request #36 from oiwn/dev
update deps, fix clippy warning
2 parents 8b1c234 + 1c91119 commit 4601d0f

File tree

8 files changed

+36
-28
lines changed

8 files changed

+36
-28
lines changed

.deny.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@ allow = [
44
"MIT",
55
"Unicode-3.0",
66
"MPL-2.0",
7-
"ISC"
7+
"ISC",
8+
"BSD-3-Clause"
9+
]
10+
11+
[advisories]
12+
ignore = [
13+
"RUSTSEC-2025-0057"
814
]

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
steps:
4646
- uses: actions/checkout@v4
4747
- uses: EmbarkStudios/cargo-deny-action@v2
48-
48+
4949
# Run cargo clippy.
5050
lint-clippy:
5151
name: Check Clippy
@@ -68,15 +68,15 @@ jobs:
6868
globs: |
6969
'**/*.md'
7070
'!target'
71-
71+
7272
# Run cargo check. This is a fast way to catch any obvious errors in the code.
7373
check:
7474
name: Check ${{ matrix.os }} ${{ matrix.toolchain }}
7575
strategy:
7676
fail-fast: false
7777
matrix:
7878
os: [ubuntu-latest, windows-latest, macos-latest]
79-
toolchain: ["1.85", "stable"]
79+
toolchain: ["1.89", "stable"]
8080
runs-on: ${{ matrix.os }}
8181
steps:
8282
- uses: actions/checkout@v4

.tmuxp.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ windows:
77
panes:
88
- shell_command:
99
- helix
10-
- window_name: cmd
10+
- window_name: agents
1111
start-directory: ./
1212
panes:
1313
- shell_command:
14-
- eza
15-
- window_name: srv
14+
- claude
15+
- window_name: cmd
1616
start-directory: ./
1717
panes:
1818
- shell_command:
@@ -21,3 +21,7 @@ windows:
2121
panes:
2222
- shell_command:
2323
- emacs -nw notes.org
24+
- window_name: files
25+
panes:
26+
- shell_command:
27+
- yazi

Cargo.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dom-content-extraction"
3-
version = "0.3.11"
3+
version = "0.3.12"
44

55
description = "Rust implementation of Content extraction via text density paper"
66
license = "MPL-2.0"
@@ -32,21 +32,20 @@ panic = "abort"
3232

3333
[dependencies]
3434
ego-tree = "0.10"
35-
scraper = "0.23"
35+
scraper = "0.24"
3636
thiserror = "2"
3737
# binary
3838
clap = { version = "4.5", features = ["derive"], optional = true }
3939
reqwest = { version = "0.12", features = ["blocking"], optional = true }
40-
tempfile = { version = "3.19", optional = true }
40+
tempfile = { version = "3.22", optional = true }
4141
url = { version = "2.5", optional = true }
42-
anyhow = { version = "1.0", optional = true }
42+
anyhow = { version = "1", optional = true }
4343
unicode-normalization = "0.1"
4444
unicode-segmentation = "1.12"
4545

4646
[dev-dependencies]
47-
criterion = "0.5"
48-
zip = "2.2"
49-
clap = { version = "4.5", features = ["derive"] }
47+
criterion = "0.7"
48+
zip = "5"
5049
anyhow = "1"
5150
regex = "1"
5251
rayon = "1"

benches/simple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use criterion::{black_box, criterion_group, criterion_main, Criterion};
1+
use criterion::{Criterion, black_box, criterion_group, criterion_main};
22
use std::{fs, io::Read, path};
33
use zip::read::ZipArchive;
44

examples/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use clap::{Parser, Subcommand};
22
use dom_content_extraction::{
3-
get_content, get_node_text, scraper::Html, DensityTree,
3+
DensityTree, get_content, get_node_text, scraper::Html,
44
};
55
use std::fs;
66

src/cetd.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,12 @@ impl<'a> DensityTree {
221221
}
222222

223223
// Handle link char count for text within links
224-
if let Some(parent) = node.parent() {
225-
if let Some(element) = parent.value().as_element() {
226-
if element.name() == "a" {
227-
density_node.value().metrics.link_char_count +=
228-
density_node.value().metrics.char_count;
229-
}
230-
}
224+
if let Some(parent) = node.parent()
225+
&& let Some(element) = parent.value().as_element()
226+
&& element.name() == "a"
227+
{
228+
density_node.value().metrics.link_char_count +=
229+
density_node.value().metrics.char_count;
231230
}
232231

233232
// Update parent metrics by combining current node's metrics
@@ -280,7 +279,7 @@ impl<'a> DensityTree {
280279
/// println!("Max density sum: {:?}", max_node.value().density_sum);
281280
/// }
282281
/// ```
283-
pub fn get_max_density_sum_node(&self) -> Option<NodeRef<DensityNode>> {
282+
pub fn get_max_density_sum_node(&self) -> Option<NodeRef<'_, DensityNode>> {
284283
self.tree.nodes().max_by(|a, b| {
285284
a.value()
286285
.density_sum

src/utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ pub fn get_node_links(
7878
let mut links: Vec<String> = vec![];
7979
let root_node = get_node_by_id(node_id, document)?;
8080
for node in root_node.descendants() {
81-
if let Some(elem) = node.value().as_element() {
82-
if let Some(link) = elem.attr("href") {
83-
links.push(link.trim().to_string());
84-
};
81+
if let Some(elem) = node.value().as_element()
82+
&& let Some(link) = elem.attr("href")
83+
{
84+
links.push(link.trim().to_string());
8585
};
8686
}
8787
Ok(links)

0 commit comments

Comments
 (0)