Skip to content

Commit 2b7fe51

Browse files
committed
new clippy fixes from upgrade
1 parent 3fafb8e commit 2b7fe51

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

examples/demo.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn main() -> reedline::Result<()> {
3939
history_session_id,
4040
Some(chrono::Utc::now()),
4141
)
42-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?,
42+
.map_err(std::io::Error::other)?,
4343
);
4444
#[cfg(not(any(feature = "sqlite", feature = "sqlite-dynlib")))]
4545
let history = Box::new(FileBackedHistory::with_file(50, "history.txt".into())?);
@@ -195,9 +195,7 @@ fn main() -> reedline::Result<()> {
195195
}
196196
if buffer.trim() == "clear-history" {
197197
let hstry = Box::new(line_editor.history_mut());
198-
hstry
199-
.clear()
200-
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
198+
hstry.clear().map_err(std::io::Error::other)?;
201199
continue;
202200
}
203201
println!("Our buffer: {buffer}");

src/core_editor/line_buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ impl LineBuffer {
323323
fn at_end_of_line_with_preceding_whitespace(&self) -> bool {
324324
!self.is_empty() // No point checking if empty
325325
&& self.insertion_point == self.lines.len()
326-
&& self.lines.chars().last().map_or(false, |c| c.is_whitespace())
326+
&& self.lines.chars().last().is_some_and(|c| c.is_whitespace())
327327
}
328328

329329
/// Cursor position at the end of the current whitespace block.

src/painting/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub(crate) fn estimate_single_line_wraps(line: &str, terminal_columns: u16) -> u
5959
let terminal_columns: usize = terminal_columns.into();
6060

6161
// integer ceiling rounding division for positive divisors
62-
let estimated_line_count = (estimated_width + terminal_columns - 1) / terminal_columns;
62+
let estimated_line_count = estimated_width.div_ceil(terminal_columns);
6363

6464
// Any wrapping will add to our overall line count
6565
estimated_line_count.saturating_sub(1)

0 commit comments

Comments
 (0)