clippy: appease clippy as of Rust 1.68.0 (#1055)

* clippy: fix derivable_impls clippy warning

This was done using `cargo clippy --fix`

* cargo fmt after autofix
This commit is contained in:
Clement Tsang 2023-03-11 01:20:46 -05:00 committed by GitHub
parent e7a5f297bc
commit c2d66af72f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 42 deletions

View file

@ -33,18 +33,13 @@ pub mod states;
use frozen_state::FrozenState;
#[derive(Debug, Clone, Eq, PartialEq)]
#[derive(Debug, Clone, Eq, PartialEq, Default)]
pub enum AxisScaling {
#[default]
Log,
Linear,
}
impl Default for AxisScaling {
fn default() -> Self {
AxisScaling::Log
}
}
/// AppConfigFields is meant to cover basic fields that would normally be set
/// by config files or launch options.
#[derive(Debug, Default, Eq, PartialEq)]

View file

@ -24,19 +24,14 @@ pub struct TempHarvest {
pub temperature: f32,
}
#[derive(Clone, Debug, Copy, PartialEq, Eq)]
#[derive(Clone, Debug, Copy, PartialEq, Eq, Default)]
pub enum TemperatureType {
#[default]
Celsius,
Kelvin,
Fahrenheit,
}
impl Default for TemperatureType {
fn default() -> Self {
TemperatureType::Celsius
}
}
fn convert_celsius_to_kelvin(celsius: f32) -> f32 {
celsius + 273.15
}

View file

@ -882,8 +882,9 @@ pub struct BottomWidget {
pub bottom_right_corner: Option<(u16, u16)>,
}
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
#[derive(Debug, Clone, Eq, PartialEq, Hash, Default)]
pub enum BottomWidgetType {
#[default]
Empty,
Cpu,
CpuLegend,
@ -927,12 +928,6 @@ impl BottomWidgetType {
}
}
impl Default for BottomWidgetType {
fn default() -> Self {
BottomWidgetType::Empty
}
}
impl std::str::FromStr for BottomWidgetType {
type Err = BottomError;

View file

@ -1,20 +1,15 @@
use tui::{layout::Rect, widgets::TableState};
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
pub enum ScrollDirection {
// UP means scrolling up --- this usually DECREMENTS
Up,
// DOWN means scrolling down --- this usually INCREMENTS
#[default]
Down,
}
impl Default for ScrollDirection {
fn default() -> Self {
ScrollDirection::Down
}
}
/// Internal state representation of a [`DataTable`](super::DataTable).
pub struct DataTableState {
/// The index from where to start displaying the rows.

View file

@ -13,19 +13,14 @@ use crate::units::data_units::DataUnit;
use crate::utils::gen_util::*;
use crate::widgets::{DiskWidgetData, TempWidgetData};
#[derive(Debug)]
#[derive(Debug, Default)]
pub enum BatteryDuration {
ToEmpty(i64),
ToFull(i64),
#[default]
Unknown,
}
impl Default for BatteryDuration {
fn default() -> Self {
BatteryDuration::Unknown
}
}
#[derive(Default, Debug)]
pub struct ConvertedBatteryData {
pub battery_name: String,

View file

@ -1,11 +1,6 @@
#[derive(Debug, Clone, Eq, PartialEq)]
#[derive(Debug, Clone, Eq, PartialEq, Default)]
pub enum DataUnit {
Byte,
#[default]
Bit,
}
impl Default for DataUnit {
fn default() -> Self {
DataUnit::Bit
}
}