mirror of
https://github.com/ratatui/ratatui.git
synced 2025-10-01 15:02:21 +00:00
chore: fix clippy warnings
This commit is contained in:
parent
a67706bea0
commit
eee37011a5
@ -8,7 +8,7 @@ use unicode_segmentation::UnicodeSegmentation;
|
|||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
|
|
||||||
/// A buffer cell
|
/// A buffer cell
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct Cell {
|
pub struct Cell {
|
||||||
pub symbol: String,
|
pub symbol: String,
|
||||||
pub fg: Color,
|
pub fg: Color,
|
||||||
@ -105,7 +105,7 @@ impl Default for Cell {
|
|||||||
/// buf.get_mut(5, 0).set_char('x');
|
/// buf.get_mut(5, 0).set_char('x');
|
||||||
/// assert_eq!(buf.get(5, 0).symbol, "x");
|
/// assert_eq!(buf.get(5, 0).symbol, "x");
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Debug, Clone, PartialEq, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
||||||
pub struct Buffer {
|
pub struct Buffer {
|
||||||
/// The area represented by this buffer
|
/// The area represented by this buffer
|
||||||
pub area: Rect,
|
pub area: Rect,
|
||||||
|
@ -51,7 +51,7 @@ pub struct Margin {
|
|||||||
pub horizontal: u16,
|
pub horizontal: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum Alignment {
|
pub enum Alignment {
|
||||||
Left,
|
Left,
|
||||||
Center,
|
Center,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use bitflags::bitflags;
|
use bitflags::bitflags;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum Color {
|
pub enum Color {
|
||||||
Reset,
|
Reset,
|
||||||
@ -115,7 +115,7 @@ bitflags! {
|
|||||||
/// buffer.get(0, 0).style(),
|
/// buffer.get(0, 0).style(),
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct Style {
|
pub struct Style {
|
||||||
pub fg: Option<Color>,
|
pub fg: Option<Color>,
|
||||||
|
@ -52,14 +52,14 @@ use unicode_segmentation::UnicodeSegmentation;
|
|||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
|
|
||||||
/// A grapheme associated to a style.
|
/// A grapheme associated to a style.
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct StyledGrapheme<'a> {
|
pub struct StyledGrapheme<'a> {
|
||||||
pub symbol: &'a str,
|
pub symbol: &'a str,
|
||||||
pub style: Style,
|
pub style: Style,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A string where all graphemes have the same style.
|
/// A string where all graphemes have the same style.
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct Span<'a> {
|
pub struct Span<'a> {
|
||||||
pub content: Cow<'a, str>,
|
pub content: Cow<'a, str>,
|
||||||
pub style: Style,
|
pub style: Style,
|
||||||
@ -194,7 +194,7 @@ impl<'a> From<&'a str> for Span<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A string composed of clusters of graphemes, each with their own style.
|
/// A string composed of clusters of graphemes, each with their own style.
|
||||||
#[derive(Debug, Clone, PartialEq, Default)]
|
#[derive(Debug, Clone, PartialEq, Default, Eq)]
|
||||||
pub struct Spans<'a>(pub Vec<Span<'a>>);
|
pub struct Spans<'a>(pub Vec<Span<'a>>);
|
||||||
|
|
||||||
impl<'a> Spans<'a> {
|
impl<'a> Spans<'a> {
|
||||||
@ -273,7 +273,7 @@ impl<'a> From<Spans<'a>> for String {
|
|||||||
/// text.extend(Text::styled("Some more lines\nnow with more style!", style));
|
/// text.extend(Text::styled("Some more lines\nnow with more style!", style));
|
||||||
/// assert_eq!(6, text.height());
|
/// assert_eq!(6, text.height());
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Debug, Clone, PartialEq, Default)]
|
#[derive(Debug, Clone, PartialEq, Default, Eq)]
|
||||||
pub struct Text<'a> {
|
pub struct Text<'a> {
|
||||||
pub lines: Vec<Spans<'a>>,
|
pub lines: Vec<Spans<'a>>,
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ use crate::{
|
|||||||
widgets::{Borders, Widget},
|
widgets::{Borders, Widget},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum BorderType {
|
pub enum BorderType {
|
||||||
Plain,
|
Plain,
|
||||||
Rounded,
|
Rounded,
|
||||||
@ -41,7 +41,7 @@ impl BorderType {
|
|||||||
/// .border_type(BorderType::Rounded)
|
/// .border_type(BorderType::Rounded)
|
||||||
/// .style(Style::default().bg(Color::Black));
|
/// .style(Style::default().bg(Color::Black));
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct Block<'a> {
|
pub struct Block<'a> {
|
||||||
/// Optional title place on the upper left of the block
|
/// Optional title place on the upper left of the block
|
||||||
title: Option<Spans<'a>>,
|
title: Option<Spans<'a>>,
|
||||||
|
@ -26,7 +26,7 @@ impl ListState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct ListItem<'a> {
|
pub struct ListItem<'a> {
|
||||||
content: Text<'a>,
|
content: Text<'a>,
|
||||||
style: Style,
|
style: Style,
|
||||||
|
@ -31,7 +31,7 @@ use unicode_width::UnicodeWidthStr;
|
|||||||
///
|
///
|
||||||
/// You can apply a [`Style`] on the entire [`Cell`] using [`Cell::style`] or rely on the styling
|
/// You can apply a [`Style`] on the entire [`Cell`] using [`Cell::style`] or rely on the styling
|
||||||
/// capabilities of [`Text`].
|
/// capabilities of [`Text`].
|
||||||
#[derive(Debug, Clone, PartialEq, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
||||||
pub struct Cell<'a> {
|
pub struct Cell<'a> {
|
||||||
content: Text<'a>,
|
content: Text<'a>,
|
||||||
style: Style,
|
style: Style,
|
||||||
@ -86,7 +86,7 @@ where
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// By default, a row has a height of 1 but you can change this using [`Row::height`].
|
/// By default, a row has a height of 1 but you can change this using [`Row::height`].
|
||||||
#[derive(Debug, Clone, PartialEq, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
||||||
pub struct Row<'a> {
|
pub struct Row<'a> {
|
||||||
cells: Vec<Cell<'a>>,
|
cells: Vec<Cell<'a>>,
|
||||||
height: u16,
|
height: u16,
|
||||||
@ -186,7 +186,7 @@ impl<'a> Row<'a> {
|
|||||||
/// // ...and potentially show a symbol in front of the selection.
|
/// // ...and potentially show a symbol in front of the selection.
|
||||||
/// .highlight_symbol(">>");
|
/// .highlight_symbol(">>");
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct Table<'a> {
|
pub struct Table<'a> {
|
||||||
/// A block to wrap the widget in
|
/// A block to wrap the widget in
|
||||||
block: Option<Block<'a>>,
|
block: Option<Block<'a>>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user