html_filter/
lib.rs

1#![doc = include_str!("../README.md")]
2#![deny(
3    missing_docs,
4    warnings,
5    deprecated_safe,
6    future_incompatible,
7    keyword_idents,
8    let_underscore,
9    nonstandard_style,
10    refining_impl_trait,
11    rust_2018_compatibility,
12    rust_2018_idioms,
13    rust_2021_compatibility,
14    rust_2024_compatibility,
15    unused,
16    clippy::all,
17    clippy::pedantic,
18    clippy::style,
19    clippy::perf,
20    clippy::complexity,
21    clippy::correctness,
22    clippy::restriction,
23    clippy::nursery,
24    clippy::cargo
25)]
26#![expect(
27    clippy::implicit_return,
28    clippy::question_mark_used,
29    clippy::else_if_without_else,
30    clippy::module_name_repetitions,
31    clippy::missing_inline_in_public_items,
32    reason = "bad lint"
33)]
34#![expect(
35    clippy::single_call_fn,
36    clippy::mod_module_files,
37    clippy::pub_with_shorthand,
38    clippy::pattern_type_mismatch,
39    reason = "style"
40)]
41#![expect(
42    clippy::while_let_on_iterator,
43    reason = "better to understand when the iterator is used after the loop breaks"
44)]
45#![expect(clippy::doc_include_without_cfg, reason = "see issue #13918")]
46#![expect(clippy::blanket_clippy_restriction_lints, reason = "I want them all")]
47#![expect(clippy::multiple_inherent_impl, reason = "useful when lots of methods")]
48#![expect(clippy::pub_use, reason = "better to not break APIs when refactoring")]
49
50// All modules are private to prevent a breaking change after refactoring this
51// crate's structure.
52
53mod errors;
54mod filter;
55mod parse;
56mod types;
57
58pub use crate::filter::types::Filter;
59pub use crate::types::html::Html;
60pub use crate::types::tag::{Attribute, Tag};
61
62/// A const equivalent of the [`Option::unwrap_or`] method.
63const fn unwrap_or(opt: Option<bool>, default: bool) -> bool {
64    match opt {
65        Some(val) => val,
66        None => default,
67    }
68}