fix: silence dead_code warnings
- SHA
a794a67921ecbddd683f4655674cdb5078271fc2- Parents
-
196304d - Tree
1fc408e
a794a67
a794a67921ecbddd683f4655674cdb5078271fc2196304d
1fc408e| Status | File | + | - |
|---|---|---|---|
| M |
src/buffer/rope.rs
|
8 | 2 |
| M |
src/editor/cursor.rs
|
2 | 0 |
| M |
src/render/screen.rs
|
1 | 0 |
| M |
src/util/mod.rs
|
0 | 2 |
| M |
src/util/unicode.rs
|
2 | 0 |
src/buffer/rope.rsmodified@@ -25,6 +25,7 @@ impl Buffer { | ||
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | + #[allow(dead_code)] | |
| 28 | 29 | pub fn from_str(s: &str) -> Self { |
| 29 | 30 | Self { |
| 30 | 31 | text: Rope::from_str(s), |
@@ -73,12 +74,13 @@ impl Buffer { | ||
| 73 | 74 | } |
| 74 | 75 | |
| 75 | 76 | /// Get total character count |
| 77 | + #[allow(dead_code)] | |
| 76 | 78 | pub fn char_count(&self) -> usize { |
| 77 | 79 | self.text.len_chars() |
| 78 | 80 | } |
| 79 | 81 | |
| 80 | 82 | /// Get a line's content (0-indexed) |
| 81 | - pub fn line(&self, line_idx: usize) -> Option<ropey::RopeSlice> { | |
| 83 | + pub fn line(&self, line_idx: usize) -> Option<ropey::RopeSlice<'_>> { | |
| 82 | 84 | if line_idx < self.text.len_lines() { |
| 83 | 85 | Some(self.text.line(line_idx)) |
| 84 | 86 | } else { |
@@ -120,6 +122,7 @@ impl Buffer { | ||
| 120 | 122 | } |
| 121 | 123 | |
| 122 | 124 | /// Convert absolute char index to (line, col) |
| 125 | + #[allow(dead_code)] | |
| 123 | 126 | pub fn char_to_line_col(&self, char_idx: usize) -> (usize, usize) { |
| 124 | 127 | let idx = char_idx.min(self.text.len_chars()); |
| 125 | 128 | let line = self.text.char_to_line(idx); |
@@ -129,6 +132,7 @@ impl Buffer { | ||
| 129 | 132 | } |
| 130 | 133 | |
| 131 | 134 | /// Get character at position |
| 135 | + #[allow(dead_code)] | |
| 132 | 136 | pub fn char_at(&self, char_idx: usize) -> Option<char> { |
| 133 | 137 | if char_idx < self.text.len_chars() { |
| 134 | 138 | Some(self.text.char(char_idx)) |
@@ -138,12 +142,14 @@ impl Buffer { | ||
| 138 | 142 | } |
| 139 | 143 | |
| 140 | 144 | /// Check if buffer is empty |
| 145 | + #[allow(dead_code)] | |
| 141 | 146 | pub fn is_empty(&self) -> bool { |
| 142 | 147 | self.text.len_chars() == 0 |
| 143 | 148 | } |
| 144 | 149 | |
| 145 | 150 | /// Get rope slice for a range |
| 146 | - pub fn slice(&self, start: usize, end: usize) -> ropey::RopeSlice { | |
| 151 | + #[allow(dead_code)] | |
| 152 | + pub fn slice(&self, start: usize, end: usize) -> ropey::RopeSlice<'_> { | |
| 147 | 153 | let start = start.min(self.text.len_chars()); |
| 148 | 154 | let end = end.min(self.text.len_chars()); |
| 149 | 155 | self.text.slice(start..end) |
src/editor/cursor.rsmodified@@ -12,12 +12,14 @@ impl Cursor { | ||
| 12 | 12 | Self::default() |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | + #[allow(dead_code)] | |
| 15 | 16 | pub fn set(&mut self, line: usize, col: usize) { |
| 16 | 17 | self.line = line; |
| 17 | 18 | self.col = col; |
| 18 | 19 | self.desired_col = col; |
| 19 | 20 | } |
| 20 | 21 | |
| 22 | + #[allow(dead_code)] | |
| 21 | 23 | pub fn move_to(&mut self, line: usize, col: usize) { |
| 22 | 24 | self.line = line; |
| 23 | 25 | self.col = col; |
src/render/screen.rsmodified@@ -46,6 +46,7 @@ impl Screen { | ||
| 46 | 46 | Ok(()) |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | + #[allow(dead_code)] | |
| 49 | 50 | pub fn clear(&mut self) -> Result<()> { |
| 50 | 51 | execute!(self.stdout, Clear(ClearType::All))?; |
| 51 | 52 | Ok(()) |
src/util/mod.rsmodified@@ -1,3 +1,1 @@ | ||
| 1 | 1 | pub mod unicode; |
| 2 | - | |
| 3 | -pub use unicode::*; | |
src/util/unicode.rsmodified@@ -1,3 +1,5 @@ | ||
| 1 | +#![allow(dead_code)] | |
| 2 | + | |
| 1 | 3 | use unicode_segmentation::UnicodeSegmentation; |
| 2 | 4 | use unicode_width::UnicodeWidthStr; |
| 3 | 5 | |