clippy fixes, fmt

This commit is contained in:
Anton-4 2021-09-25 19:17:12 +02:00
parent 4c2de0215a
commit 95a30210ce
44 changed files with 100 additions and 98 deletions

View file

@ -65,10 +65,6 @@ pub struct Attributes {
}
impl Attributes {
pub fn new() -> Attributes {
Attributes { all: Vec::new() }
}
pub fn add(&mut self, attr: Attribute) {
self.all.push(attr);
}
@ -121,3 +117,9 @@ impl Attributes {
Ok(())
}
}
impl Default for Attributes {
fn default() -> Self {
Attributes { all: Vec::new() }
}
}

View file

@ -9,7 +9,7 @@ pub fn new_equals_mn(ast_node_id: ASTNodeId, parent_id_opt: Option<MarkNodeId>)
content: nodes::EQUALS.to_owned(),
ast_node_id,
syn_high_style: HighlightStyle::Operator,
attributes: Attributes::new(),
attributes: Attributes::default(),
parent_id_opt,
newlines_at_end: 0,
}
@ -20,7 +20,7 @@ pub fn new_comma_mn(expr_id: ExprId, parent_id_opt: Option<MarkNodeId>) -> Marku
content: nodes::COMMA.to_owned(),
ast_node_id: ASTNodeId::AExprId(expr_id),
syn_high_style: HighlightStyle::Blank,
attributes: Attributes::new(),
attributes: Attributes::default(),
parent_id_opt,
newlines_at_end: 0,
}
@ -30,7 +30,7 @@ pub fn new_blank_mn(ast_node_id: ASTNodeId, parent_id_opt: Option<MarkNodeId>) -
MarkupNode::Blank {
ast_node_id,
syn_high_style: HighlightStyle::Blank,
attributes: Attributes::new(),
attributes: Attributes::default(),
parent_id_opt,
newlines_at_end: 0,
}
@ -44,7 +44,7 @@ pub fn new_blank_mn_w_nls(
MarkupNode::Blank {
ast_node_id,
syn_high_style: HighlightStyle::Blank,
attributes: Attributes::new(),
attributes: Attributes::default(),
parent_id_opt,
newlines_at_end: nr_of_newlines,
}
@ -55,7 +55,7 @@ pub fn new_colon_mn(expr_id: ExprId, parent_id_opt: Option<MarkNodeId>) -> Marku
content: nodes::COLON.to_owned(),
ast_node_id: ASTNodeId::AExprId(expr_id),
syn_high_style: HighlightStyle::Operator,
attributes: Attributes::new(),
attributes: Attributes::default(),
parent_id_opt,
newlines_at_end: 0,
}
@ -66,7 +66,7 @@ pub fn new_left_accolade_mn(expr_id: ExprId, parent_id_opt: Option<MarkNodeId>)
content: nodes::LEFT_ACCOLADE.to_owned(),
ast_node_id: ASTNodeId::AExprId(expr_id),
syn_high_style: HighlightStyle::Bracket,
attributes: Attributes::new(),
attributes: Attributes::default(),
parent_id_opt,
newlines_at_end: 0,
}
@ -77,7 +77,7 @@ pub fn new_right_accolade_mn(expr_id: ExprId, parent_id_opt: Option<MarkNodeId>)
content: nodes::RIGHT_ACCOLADE.to_owned(),
ast_node_id: ASTNodeId::AExprId(expr_id),
syn_high_style: HighlightStyle::Bracket,
attributes: Attributes::new(),
attributes: Attributes::default(),
parent_id_opt,
newlines_at_end: 0,
}
@ -88,7 +88,7 @@ pub fn new_left_square_mn(expr_id: ExprId, parent_id_opt: Option<MarkNodeId>) ->
content: nodes::LEFT_SQUARE_BR.to_owned(),
ast_node_id: ASTNodeId::AExprId(expr_id),
syn_high_style: HighlightStyle::Bracket,
attributes: Attributes::new(),
attributes: Attributes::default(),
parent_id_opt,
newlines_at_end: 0,
}
@ -99,7 +99,7 @@ pub fn new_right_square_mn(expr_id: ExprId, parent_id_opt: Option<MarkNodeId>) -
content: nodes::RIGHT_SQUARE_BR.to_owned(),
ast_node_id: ASTNodeId::AExprId(expr_id),
syn_high_style: HighlightStyle::Bracket,
attributes: Attributes::new(),
attributes: Attributes::default(),
parent_id_opt,
newlines_at_end: 0,
}

View file

@ -56,7 +56,7 @@ use roc_ast::{
},
env::Env,
},
pool::pool_str::PoolStr,
mem_pool::pool_str::PoolStr,
};
use roc_module::symbol::Interns;
use roc_utils::{index_of, slice_get};
@ -323,7 +323,7 @@ fn new_markup_node(
content: text,
ast_node_id: node_id,
syn_high_style: highlight_style,
attributes: Attributes::new(),
attributes: Attributes::default(),
parent_id_opt: None,
newlines_at_end: 0,
};
@ -528,7 +528,7 @@ pub fn expr2_to_markup<'a, 'b>(
content: val_name,
ast_node_id,
syn_high_style: HighlightStyle::Variable,
attributes: Attributes::new(),
attributes: Attributes::default(),
parent_id_opt: None,
newlines_at_end: 0,
};
@ -637,7 +637,7 @@ fn header_mn(content: String, expr_id: ExprId, mark_node_pool: &mut SlowPool) ->
content,
ast_node_id: ASTNodeId::AExprId(expr_id),
syn_high_style: HighlightStyle::PackageRelated,
attributes: Attributes::new(),
attributes: Attributes::default(),
parent_id_opt: None,
newlines_at_end: 0,
};
@ -655,7 +655,7 @@ fn header_val_mn(
content,
ast_node_id: ASTNodeId::AExprId(expr_id),
syn_high_style: highlight_style,
attributes: Attributes::new(),
attributes: Attributes::default(),
parent_id_opt: None,
newlines_at_end: 0,
};

View file

@ -31,7 +31,7 @@ pub fn tld_mark_node<'a>(
content: val_name,
ast_node_id,
syn_high_style: HighlightStyle::Variable,
attributes: Attributes::new(),
attributes: Attributes::default(),
parent_id_opt: None,
newlines_at_end: 0,
};

View file

@ -10,10 +10,6 @@ pub struct SlowPool {
}
impl SlowPool {
pub fn new() -> SlowPool {
SlowPool { nodes: Vec::new() }
}
pub fn add(&mut self, node: MarkupNode) -> MarkNodeId {
let id = self.nodes.len();
@ -73,3 +69,9 @@ impl fmt::Display for SlowPool {
Ok(())
}
}
impl Default for SlowPool {
fn default() -> Self {
SlowPool { nodes: Vec::new() }
}
}