clippy+fmt

This commit is contained in:
Anton-4 2022-03-07 19:59:45 +01:00
parent ec1e2cd1d0
commit c8fd1836c9
No known key found for this signature in database
GPG key ID: C954D6E0F9C0ABFD
27 changed files with 1949 additions and 1562 deletions

View file

@ -1,6 +1,13 @@
use crate::{syntax_highlight::HighlightStyle, slow_pool::{MarkNodeId, SlowPool}};
use crate::{
slow_pool::{MarkNodeId, SlowPool},
syntax_highlight::HighlightStyle,
};
use super::{attribute::Attributes, nodes::{self, make_nested_mn}, nodes::MarkupNode};
use super::{
attribute::Attributes,
nodes::MarkupNode,
nodes::{self, make_nested_mn},
};
pub fn new_equals_mn() -> MarkupNode {
common_text_node(nodes::EQUALS.to_owned(), HighlightStyle::Operator, 0)
@ -22,9 +29,7 @@ pub fn new_blank_mn() -> MarkupNode {
}
}
pub fn new_blank_mn_w_nls(
nr_of_newlines: usize,
) -> MarkupNode {
pub fn new_blank_mn_w_nls(nr_of_newlines: usize) -> MarkupNode {
MarkupNode::Blank {
attributes: Attributes::default(),
parent_id_opt: None,
@ -36,9 +41,7 @@ pub fn new_colon_mn() -> MarkupNode {
new_operator_mn(nodes::COLON.to_owned())
}
pub fn new_operator_mn(
content: String,
) -> MarkupNode {
pub fn new_operator_mn(content: String) -> MarkupNode {
common_text_node(content, HighlightStyle::Operator, 0)
}
@ -55,7 +58,11 @@ pub fn new_left_square_mn() -> MarkupNode {
}
pub fn new_right_square_mn() -> MarkupNode {
common_text_node(nodes::RIGHT_SQUARE_BR.to_owned(), HighlightStyle::Bracket, 0)
common_text_node(
nodes::RIGHT_SQUARE_BR.to_owned(),
HighlightStyle::Bracket,
0,
)
}
pub fn new_func_name_mn(content: String) -> MarkupNode {
@ -67,20 +74,21 @@ pub fn new_arg_name_mn(content: String) -> MarkupNode {
}
pub fn new_arrow_mn(newlines_at_end: usize) -> MarkupNode {
common_text_node(nodes::ARROW.to_owned(), HighlightStyle::Operator, newlines_at_end)
common_text_node(
nodes::ARROW.to_owned(),
HighlightStyle::Operator,
newlines_at_end,
)
}
pub fn new_comments_mn(
comment: String,
newlines_at_end: usize,
) -> MarkupNode {
pub fn new_comments_mn(comment: String, newlines_at_end: usize) -> MarkupNode {
common_text_node(comment, HighlightStyle::Comment, newlines_at_end)
}
fn common_text_node(
content: String,
highlight_style: HighlightStyle,
newlines_at_end: usize
newlines_at_end: usize,
) -> MarkupNode {
MarkupNode::Text {
content,
@ -91,7 +99,11 @@ fn common_text_node(
}
}
pub fn new_assign_mn(val_name_mn_id: MarkNodeId, equals_mn_id: MarkNodeId, expr_mark_node_id: MarkNodeId) -> MarkupNode {
pub fn new_assign_mn(
val_name_mn_id: MarkNodeId,
equals_mn_id: MarkNodeId,
expr_mark_node_id: MarkNodeId,
) -> MarkupNode {
make_nested_mn(vec![val_name_mn_id, equals_mn_id, expr_mark_node_id], 2)
}
@ -104,7 +116,11 @@ pub fn new_module_name_mn_id(mn_ids: Vec<MarkNodeId>, mark_node_pool: &mut SlowP
}
}
pub fn new_module_var_mn(module_name_id: MarkNodeId, dot_id: MarkNodeId, ident_id: MarkNodeId) -> MarkupNode {
pub fn new_module_var_mn(
module_name_id: MarkNodeId,
dot_id: MarkNodeId,
ident_id: MarkNodeId,
) -> MarkupNode {
make_nested_mn(vec![module_name_id, dot_id, ident_id], 0)
}
@ -132,5 +148,15 @@ pub fn new_if_expr_mn(
else_mn_id: MarkNodeId,
else_expr_mn_id: MarkNodeId,
) -> MarkupNode {
make_nested_mn(vec![if_mn_id, cond_expr_mn_id, then_mn_id, then_expr_mn_id, else_mn_id, else_expr_mn_id], 1)
make_nested_mn(
vec![
if_mn_id,
cond_expr_mn_id,
then_mn_id,
then_expr_mn_id,
else_mn_id,
else_expr_mn_id,
],
1,
)
}