Skip to content

Commit

Permalink
fix: clippy warnings/errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AMythicDev committed Jan 31, 2024
1 parent 27864ef commit 7efd974
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 3 additions & 0 deletions examples/large_lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ use minus::error::MinusError;

fn main() -> Result<(), MinusError> {
let output = minus::Pager::new();
output.horizontal_scroll(true)?;
output.set_run_no_overflow(true)?;
// output.set_line_numbers(minus::LineNumbers::AlwaysOn)?;

for i in 0..30 {
for _ in 0..=10 {
Expand Down
3 changes: 1 addition & 2 deletions src/core/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,7 @@ fn start_reactor(
// Cleanup the screen
//
// This is not needed in dynamic paging because this is already handled by handle_event
let p = ps.lock();
term::cleanup(&mut out_lock, &p.exit_strategy, true)?;
term::cleanup(&mut out_lock, &ps.lock().exit_strategy, true)?;

let mut rm = RUNMODE.lock();
*rm = RunMode::Uninitialized;
Expand Down
2 changes: 1 addition & 1 deletion src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ impl RunMode {
}

/// Return the number of digits in `num`
pub fn digits(num: usize) -> usize {
pub const fn digits(num: usize) -> usize {
(if num == 0 { 0 } else { num.ilog10() as usize }) + 1
}
3 changes: 1 addition & 2 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use std::collections::BTreeSet;
use std::{
collections::hash_map::RandomState,
collections::HashMap,
convert::TryInto,
io::stdout,
io::Stdout,
sync::{atomic::AtomicBool, Arc},
Expand Down Expand Up @@ -397,7 +396,7 @@ impl PagerState {
text,
attachment,
line_numbers: self.line_numbers,
len_line_number: new_lc_dgts.try_into().unwrap(),
len_line_number: new_lc_dgts,
formatted_lines_count: self.screen.formatted_lines.len(),
lines_count: old_lc,
prev_unterminated: self.unterminated,
Expand Down

0 comments on commit 7efd974

Please sign in to comment.