refactor: clippy::semicolon_if_nothing_returned (#974)

This commit is contained in:
EdJoPaTo 2024-02-27 12:17:02 +01:00 committed by Josh McKinney
parent 6fd5f631bb
commit 27680c05ce
No known key found for this signature in database
GPG key ID: 722287396A903BC5
18 changed files with 42 additions and 41 deletions

View file

@ -66,6 +66,7 @@ unsafe_code = "forbid"
[lints.clippy]
explicit_iter_loop = "warn"
needless_for_each = "warn"
semicolon_if_nothing_returned = "warn"
[features]
#! The crate provides a set of optional features that can be enabled in your `cargo.toml` file.

View file

@ -668,6 +668,6 @@ mod tests {
..Default::default()
}),
Style::default().underline_color(Color::Red)
)
);
}
}

View file

@ -733,7 +733,7 @@ fn configure_constraints(
}
}
Constraint::Length(length) => {
solver.add_constraint(element.has_int_size(length, LENGTH_SIZE_EQ))?
solver.add_constraint(element.has_int_size(length, LENGTH_SIZE_EQ))?;
}
Constraint::Percentage(p) => {
let size = area.size() * f64::from(p) / 100.00;
@ -776,7 +776,7 @@ fn configure_flex_constraints(
// constraints are satisfied
Flex::SpaceAround => {
for (left, right) in spacers.iter().tuple_combinations() {
solver.add_constraint(left.has_size(right, SPACER_SIZE_EQ))?
solver.add_constraint(left.has_size(right, SPACER_SIZE_EQ))?;
}
for spacer in spacers {
solver.add_constraint(spacer.has_min_size(spacing, SPACER_SIZE_EQ))?;
@ -788,7 +788,7 @@ fn configure_flex_constraints(
// constraints are satisfied, but the first and last spacers are zero size
Flex::SpaceBetween => {
for (left, right) in spacers_except_first_and_last.iter().tuple_combinations() {
solver.add_constraint(left.has_size(right.size(), SPACER_SIZE_EQ))?
solver.add_constraint(left.has_size(right.size(), SPACER_SIZE_EQ))?;
}
for spacer in spacers_except_first_and_last {
solver.add_constraint(spacer.has_min_size(spacing, SPACER_SIZE_EQ))?;
@ -1104,7 +1104,7 @@ mod tests {
assert!(!Layout::init_cache(15));
LAYOUT_CACHE.with(|c| {
assert_eq!(c.get().unwrap().borrow().cap().get(), 10);
})
});
}
#[test]
@ -1130,7 +1130,7 @@ mod tests {
c.get().unwrap().borrow().cap().get(),
Layout::DEFAULT_CACHE_SIZE
);
})
});
}
#[test]
@ -1406,7 +1406,7 @@ mod tests {
#[case] constraints: &[Constraint],
#[case] expected: &str,
) {
letters(flex, constraints, width, expected)
letters(flex, constraints, width, expected);
}
#[rstest]
@ -1449,7 +1449,7 @@ mod tests {
#[case] constraints: &[Constraint],
#[case] expected: &str,
) {
letters(flex, constraints, width, expected)
letters(flex, constraints, width, expected);
}
#[rstest]
@ -1485,7 +1485,7 @@ mod tests {
#[case] constraints: &[Constraint],
#[case] expected: &str,
) {
letters(flex, constraints, width, expected)
letters(flex, constraints, width, expected);
}
#[rstest] // flex, width, lengths, expected
@ -1618,7 +1618,7 @@ mod tests {
#[case] constraints: &[Constraint],
#[case] expected: &str,
) {
letters(flex, constraints, width, expected)
letters(flex, constraints, width, expected);
}
#[rstest]
@ -1655,7 +1655,7 @@ mod tests {
#[case] constraints: &[Constraint],
#[case] expected: &str,
) {
letters(flex, constraints, width, expected)
letters(flex, constraints, width, expected);
}
#[rstest]
@ -1692,7 +1692,7 @@ mod tests {
#[case] constraints: &[Constraint],
#[case] expected: &str,
) {
letters(flex, constraints, width, expected)
letters(flex, constraints, width, expected);
}
#[rstest]
@ -1795,7 +1795,7 @@ mod tests {
#[case] constraints: &[Constraint],
#[case] expected: &str,
) {
letters(flex, constraints, width, expected)
letters(flex, constraints, width, expected);
}
#[rstest]
@ -1832,7 +1832,7 @@ mod tests {
#[case] constraints: &[Constraint],
#[case] expected: &str,
) {
letters(flex, constraints, width, expected)
letters(flex, constraints, width, expected);
}
#[rstest]
@ -1869,7 +1869,7 @@ mod tests {
#[case] constraints: &[Constraint],
#[case] expected: &str,
) {
letters(flex, constraints, width, expected)
letters(flex, constraints, width, expected);
}
#[test]

View file

@ -660,7 +660,7 @@ mod tests {
.bg(Color::Black)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::ITALIC)
)
);
}
#[test]

View file

@ -438,7 +438,7 @@ impl Widget for &str {
/// [`Rect`].
impl WidgetRef for &str {
fn render_ref(&self, area: Rect, buf: &mut Buffer) {
buf.set_string(area.x, area.y, self, crate::style::Style::default())
buf.set_string(area.x, area.y, self, crate::style::Style::default());
}
}
@ -459,7 +459,7 @@ impl Widget for String {
/// without the need to give up ownership of the underlying text.
impl WidgetRef for String {
fn render_ref(&self, area: Rect, buf: &mut Buffer) {
buf.set_string(area.x, area.y, self, crate::style::Style::default())
buf.set_string(area.x, area.y, self, crate::style::Style::default());
}
}

View file

@ -848,7 +848,7 @@ mod tests {
.fg(Color::Black)
.bg(Color::White)
.add_modifier(Modifier::BOLD)
)
);
}
#[test]
@ -989,7 +989,7 @@ mod tests {
#[test]
fn test_horizontal_bars_label_width_greater_than_bar_with_style() {
test_horizontal_bars_label_width_greater_than_bar(Some(Color::White))
test_horizontal_bars_label_width_greater_than_bar(Some(Color::White));
}
/// Tests horizontal bars label are presents

View file

@ -1126,7 +1126,7 @@ mod tests {
style: Style::new(),
padding: Padding::zero(),
}
)
);
}
#[test]
@ -1198,7 +1198,7 @@ mod tests {
.bg(Color::White)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::DIM)
)
);
}
#[test]

View file

@ -168,7 +168,7 @@ mod tests {
top: 3,
bottom: 4
}
)
);
}
#[test]

View file

@ -1151,7 +1151,7 @@ mod tests {
.bg(Color::White)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::DIM)
)
);
}
#[test]
@ -1163,7 +1163,7 @@ mod tests {
.bg(Color::White)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::DIM)
)
);
}
#[test]
@ -1175,7 +1175,7 @@ mod tests {
.bg(Color::White)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::DIM)
)
);
}
#[test]
@ -1199,7 +1199,7 @@ mod tests {
let mut buffer = Buffer::empty(Rect::new(0, 0, 8, 4));
widget.render(buffer.area, &mut buffer);
assert_eq!(buffer, Buffer::with_lines(vec![" ".repeat(8); 4]))
assert_eq!(buffer, Buffer::with_lines(vec![" ".repeat(8); 4]));
}
#[test]

View file

@ -457,7 +457,7 @@ mod tests {
.bg(Color::White)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::DIM)
)
);
}
#[test]
@ -474,7 +474,7 @@ mod tests {
.bg(Color::White)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::DIM)
)
);
}
#[test]

View file

@ -1874,7 +1874,7 @@ mod tests {
.bg(Color::White)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::DIM)
)
);
}
#[test]
@ -1886,7 +1886,7 @@ mod tests {
.bg(Color::White)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::DIM)
)
);
}
#[test]

View file

@ -952,7 +952,7 @@ mod test {
.bg(Color::White)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::DIM)
)
);
}
#[test]

View file

@ -628,7 +628,7 @@ mod test {
let (word_wrapper_space, word_wrapper_widths, _) =
run_composer(Composer::WordWrapper { trim: true }, text_space, width);
assert_eq!(word_wrapper_space, vec!["AAAAAAAAAAAAAAA AAAA", "AAA",]);
assert_eq!(word_wrapper_widths, vec![20, 3])
assert_eq!(word_wrapper_widths, vec![20, 3]);
}
#[test]

View file

@ -317,6 +317,6 @@ mod tests {
.bg(Color::White)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::DIM)
)
);
}
}

View file

@ -195,6 +195,6 @@ mod tests {
.bg(Color::White)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::DIM)
)
);
}
}

View file

@ -319,6 +319,6 @@ mod tests {
.bg(Color::White)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::ITALIC)
)
);
}
}

View file

@ -1370,7 +1370,7 @@ mod tests {
assert_eq!(
table.get_columns_widths(30, 0),
&[(0, 10), (10, 10), (20, 10)]
)
);
}
#[test]
@ -1379,7 +1379,7 @@ mod tests {
.rows(vec![])
.header(Row::new(vec!["f", "g"]))
.column_spacing(0);
assert_eq!(table.get_columns_widths(10, 0), [(0, 5), (5, 5)])
assert_eq!(table.get_columns_widths(10, 0), [(0, 5), (5, 5)]);
}
#[test]
@ -1388,7 +1388,7 @@ mod tests {
.rows(vec![])
.footer(Row::new(vec!["h", "i"]))
.column_spacing(0);
assert_eq!(table.get_columns_widths(10, 0), [(0, 5), (5, 5)])
assert_eq!(table.get_columns_widths(10, 0), [(0, 5), (5, 5)]);
}
fn test_table_with_selection(
@ -1787,6 +1787,6 @@ mod tests {
.bg(Color::White)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::CROSSED_OUT)
)
);
}
}

View file

@ -511,6 +511,6 @@ mod tests {
.bg(Color::White)
.add_modifier(Modifier::BOLD)
.remove_modifier(Modifier::ITALIC)
)
);
}
}