Skip to content

Commit b55b81a

Browse files
committed
chore: Apply lint suggestions
1 parent ff4fe58 commit b55b81a

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

wasm/src/lib.rs

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,35 @@
1+
//! WASM bindings for css-inline
2+
#![warn(
3+
clippy::doc_markdown,
4+
clippy::redundant_closure,
5+
clippy::explicit_iter_loop,
6+
clippy::match_same_arms,
7+
clippy::needless_borrow,
8+
clippy::print_stdout,
9+
clippy::integer_arithmetic,
10+
clippy::cast_possible_truncation,
11+
clippy::result_unwrap_used,
12+
clippy::result_map_unwrap_or_else,
13+
clippy::option_unwrap_used,
14+
clippy::option_map_unwrap_or_else,
15+
clippy::option_map_unwrap_or,
16+
clippy::trivially_copy_pass_by_ref,
17+
clippy::needless_pass_by_value,
18+
missing_docs,
19+
missing_debug_implementations,
20+
trivial_casts,
21+
trivial_numeric_casts,
22+
unused_extern_crates,
23+
unused_import_braces,
24+
unused_qualifications,
25+
variant_size_differences
26+
)]
127
use css_inline as rust_inline;
2-
use wasm_bindgen::prelude::*;
328
use std::{
429
borrow::Cow,
530
convert::{TryFrom, TryInto},
631
};
32+
use wasm_bindgen::prelude::*;
733

834
struct InlineErrorWrapper(rust_inline::InlineError);
935

@@ -17,7 +43,7 @@ struct UrlError(url::ParseError);
1743

1844
impl From<UrlError> for JsValue {
1945
fn from(error: UrlError) -> Self {
20-
JsValue::from_str(&error.0.to_string().as_str())
46+
JsValue::from_str(error.0.to_string().as_str())
2147
}
2248
}
2349

@@ -76,11 +102,9 @@ impl TryFrom<Options> for rust_inline::InlineOptions<'_> {
76102
}
77103
}
78104

105+
/// Inline CSS styles from <style> tags to matching elements in the HTML tree and return a string.
79106
#[wasm_bindgen(skip_typescript)]
80-
pub fn inline(
81-
html: &str,
82-
options: &JsValue,
83-
) -> Result<String, JsValue> {
107+
pub fn inline(html: &str, options: &JsValue) -> Result<String, JsValue> {
84108
let options: Options = if !options.is_undefined() {
85109
options.into_serde().map_err(SerdeError)?
86110
} else {

0 commit comments

Comments
 (0)