mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-22 12:43:16 +00:00
chore: fix clippy warnings
This commit is contained in:
parent
dbf38d847a
commit
975c4165d0
2 changed files with 10 additions and 10 deletions
|
@ -88,9 +88,9 @@ fn rgb_to_byte(r: u8, g: u8, b: u8) -> u16 {
|
|||
u16::from((r & 0xC0) + ((g & 0xE0) >> 2) + ((b & 0xE0) >> 5))
|
||||
}
|
||||
|
||||
impl Into<rustbox::Color> for Color {
|
||||
fn into(self) -> rustbox::Color {
|
||||
match self {
|
||||
impl From<Color> for rustbox::Color {
|
||||
fn from(color: Color) -> rustbox::Color {
|
||||
match color {
|
||||
Color::Reset => rustbox::Color::Default,
|
||||
Color::Black | Color::Gray | Color::DarkGray => rustbox::Color::Black,
|
||||
Color::Red | Color::LightRed => rustbox::Color::Red,
|
||||
|
@ -106,16 +106,16 @@ impl Into<rustbox::Color> for Color {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<rustbox::Style> for Modifier {
|
||||
fn into(self) -> rustbox::Style {
|
||||
impl From<Modifier> for rustbox::Style {
|
||||
fn from(modifier: Modifier) -> rustbox::Style {
|
||||
let mut result = rustbox::Style::empty();
|
||||
if self.contains(Modifier::BOLD) {
|
||||
if modifier.contains(Modifier::BOLD) {
|
||||
result.insert(rustbox::RB_BOLD);
|
||||
}
|
||||
if self.contains(Modifier::UNDERLINED) {
|
||||
if modifier.contains(Modifier::UNDERLINED) {
|
||||
result.insert(rustbox::RB_UNDERLINE);
|
||||
}
|
||||
if self.contains(Modifier::REVERSED) {
|
||||
if modifier.contains(Modifier::REVERSED) {
|
||||
result.insert(rustbox::RB_REVERSE);
|
||||
}
|
||||
result
|
||||
|
|
|
@ -60,7 +60,7 @@ impl<'a> Gauge<'a> {
|
|||
/// Sets ratio ([0.0, 1.0]) directly.
|
||||
pub fn ratio(mut self, ratio: f64) -> Gauge<'a> {
|
||||
assert!(
|
||||
ratio <= 1.0 && ratio >= 0.0,
|
||||
(0.0..=1.0).contains(&ratio),
|
||||
"Ratio should be between 0 and 1 inclusively."
|
||||
);
|
||||
self.ratio = ratio;
|
||||
|
@ -213,7 +213,7 @@ impl<'a> LineGauge<'a> {
|
|||
|
||||
pub fn ratio(mut self, ratio: f64) -> Self {
|
||||
assert!(
|
||||
ratio <= 1.0 && ratio >= 0.0,
|
||||
(0.0..=1.0).contains(&ratio),
|
||||
"Ratio should be between 0 and 1 inclusively."
|
||||
);
|
||||
self.ratio = ratio;
|
||||
|
|
Loading…
Reference in a new issue