More clippy fixes

pull/305/head^2
Wilfred Hughes 2022-07-03 11:23:18 +07:00
parent 51ddcef393
commit 338e815e9b
2 changed files with 13 additions and 17 deletions

@ -486,7 +486,7 @@ pub fn print(
lhs_lines[lhs_line_num.as_usize()],
source_dims.lhs_content_width,
display_options.use_color,
lhs_highlights.get(&lhs_line_num).unwrap_or(&vec![]),
lhs_highlights.get(lhs_line_num).unwrap_or(&vec![]),
Side::Left,
),
None => vec![" ".repeat(source_dims.lhs_content_width)],
@ -496,7 +496,7 @@ pub fn print(
rhs_lines[rhs_line_num.as_usize()],
source_dims.rhs_content_width,
display_options.use_color,
rhs_highlights.get(&rhs_line_num).unwrap_or(&vec![]),
rhs_highlights.get(rhs_line_num).unwrap_or(&vec![]),
Side::Right,
),
None => vec!["".into()],
@ -520,7 +520,7 @@ pub fn print(
display_options.use_color,
);
if let Some(line_num) = lhs_line_num {
if lhs_lines_with_novel.contains(&line_num) {
if lhs_lines_with_novel.contains(line_num) {
s = if display_options.background_color.is_dark() {
s.bright_red().to_string()
} else {
@ -541,7 +541,7 @@ pub fn print(
display_options.use_color,
);
if let Some(line_num) = rhs_line_num {
if rhs_lines_with_novel.contains(&line_num) {
if rhs_lines_with_novel.contains(line_num) {
s = if display_options.background_color.is_dark() {
s.bright_green().to_string()
} else {

@ -286,15 +286,15 @@ pub fn color_positions(
}
MatchKind::Novel { highlight, .. } => {
style = novel_style(style, is_lhs, background);
if syntax_highlight {
if matches!(
if syntax_highlight
&& matches!(
highlight,
TokenKind::Delimiter
| TokenKind::Atom(AtomKind::Keyword)
| TokenKind::Atom(AtomKind::Type)
) {
style = style.bold();
}
)
{
style = style.bold();
}
if matches!(highlight, TokenKind::Atom(AtomKind::Comment)) {
style = style.italic();
@ -302,18 +302,14 @@ pub fn color_positions(
}
MatchKind::NovelWord { highlight } => {
style = novel_style(style, is_lhs, background).bold();
if syntax_highlight {
if matches!(highlight, TokenKind::Atom(AtomKind::Comment)) {
style = style.italic();
}
if syntax_highlight && matches!(highlight, TokenKind::Atom(AtomKind::Comment)) {
style = style.italic();
}
}
MatchKind::NovelLinePart { highlight, .. } => {
style = novel_style(style, is_lhs, background);
if syntax_highlight {
if matches!(highlight, TokenKind::Atom(AtomKind::Comment)) {
style = style.italic();
}
if syntax_highlight && matches!(highlight, TokenKind::Atom(AtomKind::Comment)) {
style = style.italic();
}
}
};