tenseleyflow/fackr / a794a67

Browse files

fix: silence dead_code warnings

Authored by espadonne
SHA
a794a67921ecbddd683f4655674cdb5078271fc2
Parents
196304d
Tree
1fc408e

5 changed files

StatusFile+-
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 {
2525
         }
2626
     }
2727
 
28
+    #[allow(dead_code)]
2829
     pub fn from_str(s: &str) -> Self {
2930
         Self {
3031
             text: Rope::from_str(s),
@@ -73,12 +74,13 @@ impl Buffer {
7374
     }
7475
 
7576
     /// Get total character count
77
+    #[allow(dead_code)]
7678
     pub fn char_count(&self) -> usize {
7779
         self.text.len_chars()
7880
     }
7981
 
8082
     /// 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<'_>> {
8284
         if line_idx < self.text.len_lines() {
8385
             Some(self.text.line(line_idx))
8486
         } else {
@@ -120,6 +122,7 @@ impl Buffer {
120122
     }
121123
 
122124
     /// Convert absolute char index to (line, col)
125
+    #[allow(dead_code)]
123126
     pub fn char_to_line_col(&self, char_idx: usize) -> (usize, usize) {
124127
         let idx = char_idx.min(self.text.len_chars());
125128
         let line = self.text.char_to_line(idx);
@@ -129,6 +132,7 @@ impl Buffer {
129132
     }
130133
 
131134
     /// Get character at position
135
+    #[allow(dead_code)]
132136
     pub fn char_at(&self, char_idx: usize) -> Option<char> {
133137
         if char_idx < self.text.len_chars() {
134138
             Some(self.text.char(char_idx))
@@ -138,12 +142,14 @@ impl Buffer {
138142
     }
139143
 
140144
     /// Check if buffer is empty
145
+    #[allow(dead_code)]
141146
     pub fn is_empty(&self) -> bool {
142147
         self.text.len_chars() == 0
143148
     }
144149
 
145150
     /// 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<'_> {
147153
         let start = start.min(self.text.len_chars());
148154
         let end = end.min(self.text.len_chars());
149155
         self.text.slice(start..end)
src/editor/cursor.rsmodified
@@ -12,12 +12,14 @@ impl Cursor {
1212
         Self::default()
1313
     }
1414
 
15
+    #[allow(dead_code)]
1516
     pub fn set(&mut self, line: usize, col: usize) {
1617
         self.line = line;
1718
         self.col = col;
1819
         self.desired_col = col;
1920
     }
2021
 
22
+    #[allow(dead_code)]
2123
     pub fn move_to(&mut self, line: usize, col: usize) {
2224
         self.line = line;
2325
         self.col = col;
src/render/screen.rsmodified
@@ -46,6 +46,7 @@ impl Screen {
4646
         Ok(())
4747
     }
4848
 
49
+    #[allow(dead_code)]
4950
     pub fn clear(&mut self) -> Result<()> {
5051
         execute!(self.stdout, Clear(ClearType::All))?;
5152
         Ok(())
src/util/mod.rsmodified
@@ -1,3 +1,1 @@
11
 pub mod unicode;
2
-
3
-pub use unicode::*;
src/util/unicode.rsmodified
@@ -1,3 +1,5 @@
1
+#![allow(dead_code)]
2
+
13
 use unicode_segmentation::UnicodeSegmentation;
24
 use unicode_width::UnicodeWidthStr;
35