diff --git a/examples/editor.rs b/examples/editor.rs index 846eb2b..309c5cf 100644 --- a/examples/editor.rs +++ b/examples/editor.rs @@ -28,7 +28,7 @@ struct SearchBox<'a> { open: bool, } -impl<'a> Default for SearchBox<'a> { +impl Default for SearchBox<'_> { fn default() -> Self { let mut textarea = TextArea::default(); textarea.set_block(Block::default().borders(Borders::ALL).title("Search")); @@ -39,7 +39,7 @@ impl<'a> Default for SearchBox<'a> { } } -impl<'a> SearchBox<'a> { +impl SearchBox<'_> { fn open(&mut self) { self.open = true; } @@ -96,7 +96,7 @@ struct Buffer<'a> { modified: bool, } -impl<'a> Buffer<'a> { +impl Buffer<'_> { fn new(path: PathBuf) -> io::Result { let mut textarea = if let Ok(md) = path.metadata() { if md.is_file() { @@ -143,7 +143,7 @@ struct Editor<'a> { search: SearchBox<'a>, } -impl<'a> Editor<'a> { +impl Editor<'_> { fn new(paths: I) -> io::Result where I: Iterator, @@ -348,7 +348,7 @@ impl<'a> Editor<'a> { } } -impl<'a> Drop for Editor<'a> { +impl Drop for Editor<'_> { fn drop(&mut self) { self.term.show_cursor().unwrap(); disable_raw_mode().unwrap(); diff --git a/examples/tuirs_editor.rs b/examples/tuirs_editor.rs index 2dfc881..dc1a6cd 100644 --- a/examples/tuirs_editor.rs +++ b/examples/tuirs_editor.rs @@ -31,7 +31,7 @@ struct SearchBox<'a> { open: bool, } -impl<'a> Default for SearchBox<'a> { +impl Default for SearchBox<'_> { fn default() -> Self { let mut textarea = TextArea::default(); textarea.set_block(Block::default().borders(Borders::ALL).title("Search")); @@ -42,7 +42,7 @@ impl<'a> Default for SearchBox<'a> { } } -impl<'a> SearchBox<'a> { +impl SearchBox<'_> { fn open(&mut self) { self.open = true; } @@ -99,7 +99,7 @@ struct Buffer<'a> { modified: bool, } -impl<'a> Buffer<'a> { +impl Buffer<'_> { fn new(path: PathBuf) -> io::Result { let mut textarea = if let Ok(md) = path.metadata() { if md.is_file() { @@ -146,7 +146,7 @@ struct Editor<'a> { search: SearchBox<'a>, } -impl<'a> Editor<'a> { +impl Editor<'_> { fn new(paths: I) -> io::Result where I: Iterator, @@ -351,7 +351,7 @@ impl<'a> Editor<'a> { } } -impl<'a> Drop for Editor<'a> { +impl Drop for Editor<'_> { fn drop(&mut self) { self.term.show_cursor().unwrap(); disable_raw_mode().unwrap(); diff --git a/src/textarea.rs b/src/textarea.rs index 32618a9..059354b 100644 --- a/src/textarea.rs +++ b/src/textarea.rs @@ -147,7 +147,7 @@ pub struct TextArea<'a> { /// let textarea = TextArea::from(slice.iter().copied()); /// assert_eq!(textarea.lines(), ["hello", "world"]); /// ``` -impl<'a, I> From for TextArea<'a> +impl From for TextArea<'_> where I: IntoIterator, I::Item: Into, @@ -174,7 +174,7 @@ where /// let textarea = read_from_file("README.md").unwrap(); /// assert!(!textarea.is_empty()); /// ``` -impl<'a, S: Into> FromIterator for TextArea<'a> { +impl> FromIterator for TextArea<'_> { fn from_iter>(iter: I) -> Self { iter.into() } @@ -188,7 +188,7 @@ impl<'a, S: Into> FromIterator for TextArea<'a> { /// assert_eq!(textarea.lines(), [""]); /// assert!(textarea.is_empty()); /// ``` -impl<'a> Default for TextArea<'a> { +impl Default for TextArea<'_> { fn default() -> Self { Self::new(vec![String::new()]) } diff --git a/tests/cursor.rs b/tests/cursor.rs index 4a88ac0..7c8179c 100644 --- a/tests/cursor.rs +++ b/tests/cursor.rs @@ -110,10 +110,8 @@ fn back() { #[test] fn up() { - for text in [ - ["abc", "def", "ghi"], - ["あいう", "🐢🐱🐰", "πŸ‘ͺπŸ€ŸπŸΏπŸ‘©πŸ»β€β€οΈβ€πŸ’‹β€πŸ‘¨πŸΎ"], - ] { + for text in [["abc", "def", "ghi"], ["あいう", "🐢🐱🐰", "πŸ‘ͺπŸ€ŸπŸΏπŸ‘©πŸ»β€β€οΈβ€πŸ’‹β€πŸ‘¨πŸΎ"]] + { let mut t = TextArea::from(text); for col in 0..=3 { @@ -146,10 +144,8 @@ fn up_trim() { #[test] fn down() { - for text in [ - ["abc", "def", "ghi"], - ["あいう", "🐢🐱🐰", "πŸ‘ͺπŸ€ŸπŸΏπŸ‘©πŸ»β€β€οΈβ€πŸ’‹β€πŸ‘¨πŸΎ"], - ] { + for text in [["abc", "def", "ghi"], ["あいう", "🐢🐱🐰", "πŸ‘ͺπŸ€ŸπŸΏπŸ‘©πŸ»β€β€οΈβ€πŸ’‹β€πŸ‘¨πŸΎ"]] + { let mut t = TextArea::from(text); for col in 0..=3 { @@ -217,10 +213,8 @@ fn end() { #[test] fn top() { - for text in [ - ["abc", "def", "ghi"], - ["あいう", "🐢🐱🐰", "πŸ‘ͺπŸ€ŸπŸΏπŸ‘©πŸ»β€β€οΈβ€πŸ’‹β€πŸ‘¨πŸΎ"], - ] { + for text in [["abc", "def", "ghi"], ["あいう", "🐢🐱🐰", "πŸ‘ͺπŸ€ŸπŸΏπŸ‘©πŸ»β€β€οΈβ€πŸ’‹β€πŸ‘¨πŸΎ"]] + { let mut t = TextArea::from(text); for row in 0..=2 { for col in 0..=3 { @@ -250,10 +244,8 @@ fn top_trim() { #[test] fn bottom() { - for text in [ - ["abc", "def", "ghi"], - ["あいう", "🐢🐱🐰", "πŸ‘ͺπŸ€ŸπŸΏπŸ‘©πŸ»β€β€οΈβ€πŸ’‹β€πŸ‘¨πŸΎ"], - ] { + for text in [["abc", "def", "ghi"], ["あいう", "🐢🐱🐰", "πŸ‘ͺπŸ€ŸπŸΏπŸ‘©πŸ»β€β€οΈβ€πŸ’‹β€πŸ‘¨πŸΎ"]] + { let mut t = TextArea::from(text); for row in 0..=2 { for col in 0..=3 {