mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-10 07:04:17 +00:00
refactor: clippy::similar_names (#974)
This commit is contained in:
parent
060d26b6dc
commit
a6036ad789
3 changed files with 8 additions and 4 deletions
|
@ -84,6 +84,7 @@ needless_pass_by_value = "warn"
|
|||
redundant_closure_for_method_calls = "warn"
|
||||
return_self_not_must_use = "warn"
|
||||
semicolon_if_nothing_returned = "warn"
|
||||
similar_names = "warn"
|
||||
too_many_lines = "warn"
|
||||
trivially_copy_pass_by_ref = "warn"
|
||||
uninlined_format_args = "warn"
|
||||
|
|
|
@ -393,12 +393,12 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn repeated_attributes() {
|
||||
let cyan_bg = Style::default().bg(Color::Cyan);
|
||||
let cyan_fg = Style::default().fg(Color::Cyan);
|
||||
let bg = Style::default().bg(Color::Cyan);
|
||||
let fg = Style::default().fg(Color::Cyan);
|
||||
|
||||
// Behavior: the last one set is the definitive one
|
||||
assert_eq!("hello".on_red().on_cyan(), Span::styled("hello", cyan_bg));
|
||||
assert_eq!("hello".red().cyan(), Span::styled("hello", cyan_fg));
|
||||
assert_eq!("hello".on_red().on_cyan(), Span::styled("hello", bg));
|
||||
assert_eq!("hello".red().cyan(), Span::styled("hello", fg));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -711,6 +711,7 @@ impl Block<'_> {
|
|||
/// be cut off if the block is too small to fit all titles. This is not ideal and should be
|
||||
/// the left side of that leftmost that is cut off. This is due to the line being truncated
|
||||
/// incorrectly. See <https://github.com/ratatui-org/ratatui/issues/932>
|
||||
#[allow(clippy::similar_names)]
|
||||
fn render_right_titles(&self, position: Position, area: Rect, buf: &mut Buffer) {
|
||||
let titles = self.filtered_titles(position, Alignment::Right);
|
||||
let mut titles_area = self.titles_area(area, position);
|
||||
|
@ -745,6 +746,7 @@ impl Block<'_> {
|
|||
/// Currently this method aligns the titles to the left inside a centered area. This is not
|
||||
/// ideal and should be fixed in the future to align the titles to the center of the block and
|
||||
/// truncate both sides of the titles if the block is too small to fit all titles.
|
||||
#[allow(clippy::similar_names)]
|
||||
fn render_center_titles(&self, position: Position, area: Rect, buf: &mut Buffer) {
|
||||
let titles = self
|
||||
.filtered_titles(position, Alignment::Center)
|
||||
|
@ -779,6 +781,7 @@ impl Block<'_> {
|
|||
}
|
||||
|
||||
/// Render titles aligned to the left of the block
|
||||
#[allow(clippy::similar_names)]
|
||||
fn render_left_titles(&self, position: Position, area: Rect, buf: &mut Buffer) {
|
||||
let titles = self.filtered_titles(position, Alignment::Left);
|
||||
let mut titles_area = self.titles_area(area, position);
|
||||
|
|
Loading…
Reference in a new issue