refactor(lints): add lints to scrollbar (#974)

This commit is contained in:
EdJoPaTo 2024-02-27 12:03:45 +01:00 committed by Josh McKinney
parent e02f4768ce
commit 37b957c7e1
No known key found for this signature in database
GPG Key ID: 722287396A903BC5
2 changed files with 14 additions and 1 deletions

View File

@ -13,6 +13,9 @@
//! [examples]: https://github.com/ratatui-org/ratatui/blob/main/examples
//! [examples readme]: https://github.com/ratatui-org/ratatui/blob/main/examples/README.md
#![warn(clippy::pedantic)]
#![allow(clippy::wildcard_imports)]
use std::{
error::Error,
io,
@ -107,6 +110,7 @@ fn run_app<B: Backend>(
}
}
#[allow(clippy::too_many_lines, clippy::cast_possible_truncation)]
fn ui(f: &mut Frame, app: &mut App) {
let size = f.size();

View File

@ -1,3 +1,12 @@
#![warn(clippy::pedantic)]
#![allow(
clippy::cast_possible_truncation,
clippy::cast_precision_loss,
clippy::cast_sign_loss,
clippy::module_name_repetitions,
clippy::wildcard_imports
)]
use std::iter;
use strum::{Display, EnumString};
@ -523,7 +532,7 @@ impl Scrollbar<'_> {
///
/// This method returns the length of the start, thumb, and end as a tuple.
fn part_lengths(&self, area: Rect, state: &ScrollbarState) -> (usize, usize, usize) {
let track_length = self.track_length_excluding_arrow_heads(area) as f64;
let track_length = f64::from(self.track_length_excluding_arrow_heads(area));
let viewport_length = self.viewport_length(state, area) as f64;
// Ensure that the position of the thumb is within the bounds of the content taking into