aboutsummaryrefslogtreecommitdiff
path: root/helix-tui
diff options
context:
space:
mode:
Diffstat (limited to 'helix-tui')
-rw-r--r--helix-tui/src/buffer.rs11
-rw-r--r--helix-tui/src/text.rs16
-rw-r--r--helix-tui/src/widgets/table.rs11
3 files changed, 4 insertions, 34 deletions
diff --git a/helix-tui/src/buffer.rs b/helix-tui/src/buffer.rs
index f480bc2f..c49a0200 100644
--- a/helix-tui/src/buffer.rs
+++ b/helix-tui/src/buffer.rs
@@ -102,7 +102,7 @@ impl Default for Cell {
/// buf.get_mut(5, 0).set_char('x');
/// assert_eq!(buf.get(5, 0).symbol, "x");
/// ```
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Default, Clone, PartialEq)]
pub struct Buffer {
/// The area represented by this buffer
pub area: Rect,
@@ -111,15 +111,6 @@ pub struct Buffer {
pub content: Vec<Cell>,
}
-impl Default for Buffer {
- fn default() -> Buffer {
- Buffer {
- area: Default::default(),
- content: Vec::new(),
- }
- }
-}
-
impl Buffer {
/// Returns a Buffer with all cells set to the default one
pub fn empty(area: Rect) -> Buffer {
diff --git a/helix-tui/src/text.rs b/helix-tui/src/text.rs
index b8e52479..8a974ddb 100644
--- a/helix-tui/src/text.rs
+++ b/helix-tui/src/text.rs
@@ -195,15 +195,9 @@ impl<'a> From<&'a str> for Span<'a> {
}
/// A string composed of clusters of graphemes, each with their own style.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Default, Clone, PartialEq)]
pub struct Spans<'a>(pub Vec<Span<'a>>);
-impl<'a> Default for Spans<'a> {
- fn default() -> Spans<'a> {
- Spans(Vec::new())
- }
-}
-
impl<'a> Spans<'a> {
/// Returns the width of the underlying string.
///
@@ -280,17 +274,11 @@ impl<'a> From<Spans<'a>> for String {
/// text.extend(Text::styled("Some more lines\nnow with more style!", style));
/// assert_eq!(6, text.height());
/// ```
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Default, Clone, PartialEq)]
pub struct Text<'a> {
pub lines: Vec<Spans<'a>>,
}
-impl<'a> Default for Text<'a> {
- fn default() -> Text<'a> {
- Text { lines: Vec::new() }
- }
-}
-
impl<'a> Text<'a> {
/// Create some text (potentially multiple lines) with no style.
///
diff --git a/helix-tui/src/widgets/table.rs b/helix-tui/src/widgets/table.rs
index d7caa0b0..6aee5988 100644
--- a/helix-tui/src/widgets/table.rs
+++ b/helix-tui/src/widgets/table.rs
@@ -363,21 +363,12 @@ impl<'a> Table<'a> {
}
}
-#[derive(Debug, Clone)]
+#[derive(Debug, Default, Clone)]
pub struct TableState {
pub offset: usize,
pub selected: Option<usize>,
}
-impl Default for TableState {
- fn default() -> TableState {
- TableState {
- offset: 0,
- selected: None,
- }
- }
-}
-
impl TableState {
pub fn selected(&self) -> Option<usize> {
self.selected