Adopt and apply nightly clippy configuration
This commit is contained in:
parent
2e95c94f54
commit
5b5541c28f
33 changed files with 233 additions and 139 deletions
|
|
@ -28,15 +28,21 @@ impl Anchor {
|
|||
self.route();
|
||||
}
|
||||
|
||||
pub fn balanced(&self) -> bool { self.balanced }
|
||||
pub const fn balanced(&self) -> bool { self.balanced }
|
||||
|
||||
pub fn set_balanced(&mut self, balanced: bool) { self.balanced = balanced; }
|
||||
pub const fn set_balanced(&mut self, balanced: bool) {
|
||||
self.balanced = balanced;
|
||||
}
|
||||
|
||||
pub fn external(&self) -> bool { self.external }
|
||||
pub const fn external(&self) -> bool { self.external }
|
||||
|
||||
pub fn set_external(&mut self, external: bool) { self.external = external; }
|
||||
pub const fn set_external(&mut self, external: bool) {
|
||||
self.external = external;
|
||||
}
|
||||
|
||||
pub fn set_leading(&mut self, leading: bool) { self.leading = leading; }
|
||||
pub const fn set_leading(&mut self, leading: bool) {
|
||||
self.leading = leading;
|
||||
}
|
||||
|
||||
pub fn node(&self) -> Option<Node> { self.node.clone() }
|
||||
|
||||
|
|
@ -52,7 +58,7 @@ impl Anchor {
|
|||
|
||||
fn route(&mut self) {
|
||||
self.destination = if let Some(destination) = self.destination.clone() {
|
||||
if destination.contains(":") || destination.contains("/") {
|
||||
if destination.contains(':') || destination.contains('/') {
|
||||
Some(destination)
|
||||
} else if destination.is_empty() && self.text.is_empty() {
|
||||
None
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ pub struct Bold {
|
|||
}
|
||||
|
||||
impl Bold {
|
||||
pub fn new(open: bool) -> Bold { Bold { open } }
|
||||
pub const fn new(open: bool) -> Bold { Bold { open } }
|
||||
}
|
||||
|
||||
impl Parseable for Bold {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ pub struct CheckBox {
|
|||
}
|
||||
|
||||
impl CheckBox {
|
||||
pub fn new(checked: bool) -> CheckBox { CheckBox { checked } }
|
||||
pub const fn new(checked: bool) -> CheckBox { CheckBox { checked } }
|
||||
}
|
||||
|
||||
impl Parseable for CheckBox {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ pub struct Code {
|
|||
}
|
||||
|
||||
impl Code {
|
||||
pub fn new(open: bool) -> Code { Code { open } }
|
||||
pub const fn new(open: bool) -> Code { Code { open } }
|
||||
}
|
||||
|
||||
impl Parseable for Code {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ impl Header {
|
|||
) -> String {
|
||||
let base_id = if !config.ascii_dom_ids || next_lexeme.next().is_ascii()
|
||||
{
|
||||
next_lexeme.next().clone()
|
||||
next_lexeme.next()
|
||||
} else {
|
||||
String::from("h")
|
||||
};
|
||||
|
|
@ -60,7 +60,7 @@ impl Header {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn level(&self) -> u8 {
|
||||
pub const fn level(&self) -> u8 {
|
||||
match self.level {
|
||||
Level::One => 1,
|
||||
Level::Two => 2,
|
||||
|
|
@ -147,7 +147,7 @@ pub enum Level {
|
|||
}
|
||||
|
||||
impl Level {
|
||||
fn from_u8(u: u8) -> Level {
|
||||
const fn from_u8(u: u8) -> Level {
|
||||
if u <= 1 {
|
||||
Level::One
|
||||
} else if u == 2 {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::syntax::content::{Parseable, parser::Lexeme};
|
||||
|
||||
#[derive(Default, Debug, Clone, Eq, PartialEq)]
|
||||
pub struct LineBreak {}
|
||||
pub struct LineBreak;
|
||||
|
||||
impl Parseable for LineBreak {
|
||||
fn probe(lexeme: &Lexeme) -> bool {
|
||||
|
|
|
|||
|
|
@ -43,19 +43,19 @@ impl Parseable for List {
|
|||
.unwrap_or(0)
|
||||
.strict_div(scale);
|
||||
|
||||
output.push_str(&format!("<li>{}", item.text));
|
||||
write_log!(output, "<li>{}", item.text);
|
||||
|
||||
if next_level > level {
|
||||
// open nested lists
|
||||
for _ in 0..(next_level.saturating_sub(level)) {
|
||||
output.push_str(&format!("<{tag}>\n"));
|
||||
write_log!(output, "<{tag}>\n");
|
||||
}
|
||||
} else {
|
||||
// close current item
|
||||
output.push_str("</li>");
|
||||
// close nested lists
|
||||
for _ in 0..(level.saturating_sub(next_level)) {
|
||||
output.push_str(&format!("</{tag}></li>"));
|
||||
write_log!(output, "</{tag}></li>");
|
||||
}
|
||||
output.push('\n');
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ impl Parseable for List {
|
|||
}
|
||||
|
||||
impl List {
|
||||
pub fn new(ordered: bool) -> List {
|
||||
pub const fn new(ordered: bool) -> List {
|
||||
List {
|
||||
ordered,
|
||||
items: vec![],
|
||||
|
|
@ -202,7 +202,7 @@ mod tests {
|
|||
fn token_display() {
|
||||
let list = List::new(false);
|
||||
assert_eq!(
|
||||
format!("{}", Token::List(list.clone())),
|
||||
format!("{}", Token::List(list)),
|
||||
"Tk:List [0 unordered items]"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ pub struct Oblique {
|
|||
}
|
||||
|
||||
impl Oblique {
|
||||
pub fn new(open: bool) -> Oblique { Oblique { open } }
|
||||
pub const fn new(open: bool) -> Oblique { Oblique { open } }
|
||||
}
|
||||
|
||||
impl Parseable for Oblique {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ pub struct Paragraph {
|
|||
}
|
||||
|
||||
impl Paragraph {
|
||||
pub fn new(open: bool) -> Paragraph { Paragraph { open: Some(open) } }
|
||||
pub const fn new(open: bool) -> Paragraph { Paragraph { open: Some(open) } }
|
||||
|
||||
pub fn probe_end(lexeme: &Lexeme) -> bool {
|
||||
lexeme.match_char('\n') && lexeme.match_next_char('\n')
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ pub struct PreFormat {
|
|||
}
|
||||
|
||||
impl PreFormat {
|
||||
pub fn new(open: bool) -> PreFormat { PreFormat { open: Some(open) } }
|
||||
pub const fn new(open: bool) -> PreFormat { PreFormat { open: Some(open) } }
|
||||
}
|
||||
|
||||
impl std::fmt::Display for PreFormat {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ pub struct Strike {
|
|||
}
|
||||
|
||||
impl Strike {
|
||||
pub fn new(open: bool) -> Strike { Strike { open } }
|
||||
pub const fn new(open: bool) -> Strike { Strike { open } }
|
||||
}
|
||||
|
||||
impl Parseable for Strike {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ pub struct Underline {
|
|||
}
|
||||
|
||||
impl Underline {
|
||||
pub fn new(open: bool) -> Underline { Underline { open } }
|
||||
pub const fn new(open: bool) -> Underline { Underline { open } }
|
||||
}
|
||||
|
||||
impl Parseable for Underline {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ pub struct Verse {
|
|||
}
|
||||
|
||||
impl Verse {
|
||||
pub fn new(open: bool) -> Verse {
|
||||
pub const fn new(open: bool) -> Verse {
|
||||
Verse {
|
||||
open: Some(open),
|
||||
citation: None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue