diff --git a/src/minify/attr.rs b/src/minify/attr.rs index a0a25a9..bb9e4cd 100644 --- a/src/minify/attr.rs +++ b/src/minify/attr.rs @@ -150,7 +150,7 @@ impl AttrValMinified { self.prefix.len() + (self.data.len() - self.start) + self.suffix.len() } - pub fn out(&self, out: &mut Vec) -> () { + pub fn out(&self, out: &mut Vec) { out.extend_from_slice(self.prefix); out.extend_from_slice(&self.data[self.start..]); out.extend_from_slice(self.suffix); diff --git a/src/minify/bang.rs b/src/minify/bang.rs index 2f3c882..ba55e10 100644 --- a/src/minify/bang.rs +++ b/src/minify/bang.rs @@ -1,9 +1,9 @@ use crate::cfg::Cfg; -pub fn minify_bang(cfg: &Cfg, out: &mut Vec, code: &[u8], ended: bool) -> () { +pub fn minify_bang(cfg: &Cfg, out: &mut Vec, code: &[u8], ended: bool) { if !cfg.remove_bangs { out.extend_from_slice(b""); }; diff --git a/src/minify/comment.rs b/src/minify/comment.rs index edb1ed5..0ab2733 100644 --- a/src/minify/comment.rs +++ b/src/minify/comment.rs @@ -1,9 +1,9 @@ use crate::cfg::Cfg; -pub fn minify_comment(cfg: &Cfg, out: &mut Vec, code: &[u8], ended: bool) -> () { +pub fn minify_comment(cfg: &Cfg, out: &mut Vec, code: &[u8], ended: bool) { if !cfg.remove_comments { out.extend_from_slice(b""); }; diff --git a/src/minify/content.rs b/src/minify/content.rs index 80afde4..01c7264 100644 --- a/src/minify/content.rs +++ b/src/minify/content.rs @@ -48,7 +48,7 @@ pub fn minify_content( // Use empty slice if none. parent: &[u8], mut nodes: Vec, -) -> () { +) { let &WhitespaceMinification { collapse, destroy_whole, diff --git a/src/minify/css.rs b/src/minify/css.rs index 43523de..9618d8a 100644 --- a/src/minify/css.rs +++ b/src/minify/css.rs @@ -1,6 +1,6 @@ use crate::cfg::Cfg; -pub fn minify_css(cfg: &Cfg, out: &mut Vec, code: &[u8]) -> () { +pub fn minify_css(_cfg: &Cfg, out: &mut Vec, code: &[u8]) { // TODO out.extend_from_slice(code); } diff --git a/src/minify/element.rs b/src/minify/element.rs index b891ffd..cb8a515 100644 --- a/src/minify/element.rs +++ b/src/minify/element.rs @@ -22,7 +22,7 @@ pub fn minify_element( attributes: HashMap, Vec>, closing_tag: ElementClosingTag, children: Vec, -) -> () { +) { let can_omit_closing_tag = cfg.omit_closing_tags && (can_omit_as_before(tag_name, next_sibling_as_element_tag_name) || (is_last_child_text_or_element_node && can_omit_as_last_node(parent, tag_name))); diff --git a/src/minify/instruction.rs b/src/minify/instruction.rs index 36ffcf6..ff29a43 100644 --- a/src/minify/instruction.rs +++ b/src/minify/instruction.rs @@ -1,9 +1,9 @@ use crate::cfg::Cfg; -pub fn minify_instruction(cfg: &Cfg, out: &mut Vec, code: &[u8], ended: bool) -> () { +pub fn minify_instruction(cfg: &Cfg, out: &mut Vec, code: &[u8], ended: bool) { if !cfg.remove_processing_instructions { out.extend_from_slice(b""); }; diff --git a/src/minify/js.rs b/src/minify/js.rs index 9b20c4f..8a85b0a 100644 --- a/src/minify/js.rs +++ b/src/minify/js.rs @@ -1,6 +1,6 @@ use crate::cfg::Cfg; -pub fn minify_js(cfg: &Cfg, out: &mut Vec, code: &[u8]) -> () { +pub fn minify_js(_cfg: &Cfg, out: &mut Vec, code: &[u8]) { // TODO out.extend_from_slice(code); } diff --git a/src/parse/mod.rs b/src/parse/mod.rs index 6a0c91b..cd6474d 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -32,7 +32,7 @@ impl<'c> Code<'c> { Checkpoint(self.next) } - pub fn restore_checkpoint(&mut self, cp: Checkpoint) -> () { + pub fn restore_checkpoint(&mut self, cp: Checkpoint) { self.next = cp.0; } @@ -51,7 +51,7 @@ impl<'c> Code<'c> { } pub fn shift_if_next_in_lookup(&mut self, lookup: &'static Lookup) -> Option { - let c = self.code.get(self.next).filter(|&&n| lookup[n]).map(|&c| c); + let c = self.code.get(self.next).filter(|&&n| lookup[n]).copied(); if c.is_some() { self.next += 1; }; @@ -62,15 +62,14 @@ impl<'c> Code<'c> { let c = self .code .get(self.next) - .filter(|&&n| !lookup[n]) - .map(|&c| c); + .filter(|&&n| !lookup[n]).copied(); if c.is_some() { self.next += 1; }; c } - pub fn shift(&mut self, n: usize) -> () { + pub fn shift(&mut self, n: usize) { self.next += n; } diff --git a/src/spec/entity/decode.rs b/src/spec/entity/decode.rs index 2c212e3..7349945 100644 --- a/src/spec/entity/decode.rs +++ b/src/spec/entity/decode.rs @@ -68,7 +68,7 @@ fn parse_numeric_entity( // Browsers decode to a replacement character (U+FFFD) if malformed. let char = Some(value) .filter(|_| digits <= max_digits) - .and_then(|v| from_u32(v)) + .and_then(from_u32) .unwrap_or('\u{FFFD}'); ParsedEntity { read_len: read_next, diff --git a/src/spec/tag/mod.rs b/src/spec/tag/mod.rs index 0df2160..13d1485 100644 --- a/src/spec/tag/mod.rs +++ b/src/spec/tag/mod.rs @@ -3,4 +3,4 @@ pub mod omission; pub mod void; pub mod whitespace; -pub static EMPTY_SLICE: &'static [u8] = &[]; +pub static EMPTY_SLICE: &[u8] = &[]; diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 70bf1e7..7654784 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -1,4 +1,4 @@ -fn _eval(src: &'static [u8], expected: &'static [u8], cfg: &super::Cfg) -> () { +fn _eval(src: &'static [u8], expected: &'static [u8], cfg: &super::Cfg) { let mut code = src.to_vec(); let min = super::minify(&mut code, cfg); assert_eq!( @@ -7,7 +7,7 @@ fn _eval(src: &'static [u8], expected: &'static [u8], cfg: &super::Cfg) -> () { ); } -fn eval(src: &'static [u8], expected: &'static [u8]) -> () { +fn eval(src: &'static [u8], expected: &'static [u8]) { _eval( src, expected, diff --git a/src/whitespace.rs b/src/whitespace.rs index 3353d3e..81ed0ae 100644 --- a/src/whitespace.rs +++ b/src/whitespace.rs @@ -1,6 +1,6 @@ use crate::gen::codepoints::WHITESPACE; -pub fn left_trim(val: &mut Vec) -> () { +pub fn left_trim(val: &mut Vec) { let mut len = 0; while val.get(len).filter(|&&c| WHITESPACE[c]).is_some() { len += 1; @@ -8,7 +8,7 @@ pub fn left_trim(val: &mut Vec) -> () { val.drain(0..len); } -pub fn right_trim(val: &mut Vec) -> () { +pub fn right_trim(val: &mut Vec) { let mut retain = val.len(); while retain > 0 && val.get(retain - 1).filter(|&&c| WHITESPACE[c]).is_some() { retain -= 1; @@ -16,7 +16,7 @@ pub fn right_trim(val: &mut Vec) -> () { val.truncate(retain); } -pub fn collapse_whitespace(val: &mut Vec) -> () { +pub fn collapse_whitespace(val: &mut Vec) { let mut write = 0; let mut in_whitespace = false; for i in 0..val.len() {