Clippy fixed. Fix openrc files
This commit is contained in:
parent
0b388e2ae3
commit
24ccf0d59f
@ -3,8 +3,8 @@ use gumdrop::Options;
|
|||||||
use amdgpu::utils::hw_mons;
|
use amdgpu::utils::hw_mons;
|
||||||
use amdgpu_config::fan::Config;
|
use amdgpu_config::fan::Config;
|
||||||
|
|
||||||
use crate::{AmdFanError, FanMode};
|
|
||||||
use crate::command::Fan;
|
use crate::command::Fan;
|
||||||
|
use crate::{AmdFanError, FanMode};
|
||||||
|
|
||||||
/// Change card fan mode to either automatic or manual
|
/// Change card fan mode to either automatic or manual
|
||||||
pub fn run(switcher: Switcher, mode: FanMode, config: Config) -> crate::Result<()> {
|
pub fn run(switcher: Switcher, mode: FanMode, config: Config) -> crate::Result<()> {
|
||||||
|
@ -11,7 +11,7 @@ pub fn restore_automatic() {
|
|||||||
pwm_min: None,
|
pwm_min: None,
|
||||||
pwm_max: None,
|
pwm_max: None,
|
||||||
})
|
})
|
||||||
.write_automatic()
|
.write_automatic()
|
||||||
{
|
{
|
||||||
log::error!("{}", error);
|
log::error!("{}", error);
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,8 @@ use gumdrop::Options;
|
|||||||
use amdgpu::utils::hw_mons;
|
use amdgpu::utils::hw_mons;
|
||||||
use amdgpu_config::fan::Config;
|
use amdgpu_config::fan::Config;
|
||||||
|
|
||||||
use crate::AmdFanError;
|
|
||||||
use crate::command::Fan;
|
use crate::command::Fan;
|
||||||
|
use crate::AmdFanError;
|
||||||
|
|
||||||
/// Start service which will change fan speed according to config and GPU temperature
|
/// Start service which will change fan speed according to config and GPU temperature
|
||||||
pub fn run(config: Config) -> crate::Result<()> {
|
pub fn run(config: Config) -> crate::Result<()> {
|
||||||
|
@ -30,8 +30,8 @@ impl std::str::FromStr for Card {
|
|||||||
|
|
||||||
impl<'de> Deserialize<'de> for Card {
|
impl<'de> Deserialize<'de> for Card {
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
where
|
where
|
||||||
D: serde::Deserializer<'de>,
|
D: serde::Deserializer<'de>,
|
||||||
{
|
{
|
||||||
use serde::de::{self, Visitor};
|
use serde::de::{self, Visitor};
|
||||||
|
|
||||||
@ -45,8 +45,8 @@ impl<'de> Deserialize<'de> for Card {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
||||||
where
|
where
|
||||||
E: de::Error,
|
E: de::Error,
|
||||||
{
|
{
|
||||||
match value.parse::<Card>() {
|
match value.parse::<Card>() {
|
||||||
Ok(card) => Ok(*card),
|
Ok(card) => Ok(*card),
|
||||||
@ -68,8 +68,8 @@ impl<'de> Deserialize<'de> for Card {
|
|||||||
|
|
||||||
impl serde::Serialize for Card {
|
impl serde::Serialize for Card {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
S: serde::Serializer,
|
S: serde::Serializer,
|
||||||
{
|
{
|
||||||
serializer.serialize_str(&self.to_string())
|
serializer.serialize_str(&self.to_string())
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@ impl std::str::FromStr for TempInput {
|
|||||||
|
|
||||||
impl<'de> serde::Deserialize<'de> for TempInput {
|
impl<'de> serde::Deserialize<'de> for TempInput {
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
where
|
where
|
||||||
D: serde::Deserializer<'de>,
|
D: serde::Deserializer<'de>,
|
||||||
{
|
{
|
||||||
use serde::de::{self, Visitor};
|
use serde::de::{self, Visitor};
|
||||||
|
|
||||||
@ -52,8 +52,8 @@ impl<'de> serde::Deserialize<'de> for TempInput {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
|
||||||
where
|
where
|
||||||
E: de::Error,
|
E: de::Error,
|
||||||
{
|
{
|
||||||
match value.parse::<TempInput>() {
|
match value.parse::<TempInput>() {
|
||||||
Ok(temp) => Ok(temp.0),
|
Ok(temp) => Ok(temp.0),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::io::ErrorKind;
|
use std::io::ErrorKind;
|
||||||
|
|
||||||
use crate::{Card, CONFIG_DIR, hw_mon, ROOT_DIR};
|
|
||||||
use crate::hw_mon::HwMon;
|
use crate::hw_mon::HwMon;
|
||||||
|
use crate::{hw_mon, Card, CONFIG_DIR, ROOT_DIR};
|
||||||
|
|
||||||
/// linear mapping from the xrange to the yrange
|
/// linear mapping from the xrange to the yrange
|
||||||
pub fn linear_map(x: f64, x1: f64, x2: f64, y1: f64, y2: f64) -> f64 {
|
pub fn linear_map(x: f64, x1: f64, x2: f64, y1: f64, y2: f64) -> f64 {
|
||||||
@ -45,10 +45,10 @@ pub fn hw_mons(filter: bool) -> std::io::Result<Vec<HwMon>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn ensure_config<Config, Error, P>(config_path: P) -> std::result::Result<Config, Error>
|
pub fn ensure_config<Config, Error, P>(config_path: P) -> std::result::Result<Config, Error>
|
||||||
where
|
where
|
||||||
Config: serde::Serialize + serde::de::DeserializeOwned + Default + Sized,
|
Config: serde::Serialize + serde::de::DeserializeOwned + Default + Sized,
|
||||||
P: AsRef<std::path::Path>,
|
P: AsRef<std::path::Path>,
|
||||||
Error: From<std::io::Error>,
|
Error: From<std::io::Error>,
|
||||||
{
|
{
|
||||||
match std::fs::read_to_string(&config_path) {
|
match std::fs::read_to_string(&config_path) {
|
||||||
Ok(s) => Ok(toml::from_str::<Config>(s.as_str()).unwrap()),
|
Ok(s) => Ok(toml::from_str::<Config>(s.as_str()).unwrap()),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use amdgpu::utils::hw_mons;
|
use amdgpu::utils::hw_mons;
|
||||||
|
|
||||||
use crate::{Config, VoltageError};
|
|
||||||
use crate::command::VoltageManipulator;
|
use crate::command::VoltageManipulator;
|
||||||
|
use crate::{Config, VoltageError};
|
||||||
|
|
||||||
#[derive(Debug, gumdrop::Options)]
|
#[derive(Debug, gumdrop::Options)]
|
||||||
pub struct ApplyChanges {
|
pub struct ApplyChanges {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
use amdgpu::hw_mon::HwMon;
|
use amdgpu::hw_mon::HwMon;
|
||||||
|
|
||||||
use crate::{Config, VoltageError};
|
|
||||||
use crate::apply_changes::ApplyChanges;
|
use crate::apply_changes::ApplyChanges;
|
||||||
use crate::change_state::ChangeState;
|
use crate::change_state::ChangeState;
|
||||||
use crate::clock_state::{ClockState, Frequency, Voltage};
|
use crate::clock_state::{ClockState, Frequency, Voltage};
|
||||||
use crate::print_states::PrintStates;
|
use crate::print_states::PrintStates;
|
||||||
use crate::setup_info::SetupInfo;
|
use crate::setup_info::SetupInfo;
|
||||||
|
use crate::{Config, VoltageError};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum HardwareModule {
|
pub enum HardwareModule {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use gumdrop::Options;
|
use gumdrop::Options;
|
||||||
|
|
||||||
use amdgpu::utils::ensure_config_dir;
|
use amdgpu::utils::ensure_config_dir;
|
||||||
use amdgpu_config::voltage::{Config, load_config};
|
use amdgpu_config::voltage::{load_config, Config};
|
||||||
|
|
||||||
use crate::command::VoltageCommand;
|
use crate::command::VoltageCommand;
|
||||||
use crate::error::VoltageError;
|
use crate::error::VoltageError;
|
||||||
|
Loading…
Reference in New Issue
Block a user