diff --git a/gpu-detection/src/lib.rs b/gpu-detection/src/lib.rs index ef9e942..670e9c5 100644 --- a/gpu-detection/src/lib.rs +++ b/gpu-detection/src/lib.rs @@ -1,7 +1,7 @@ use anyhow::{bail, Context}; use model::{Clocks, Cuda, Gpu, Memory}; -use nvml_wrapper::{enum_wrappers::device::Clock, Device, Nvml}; use nvml_wrapper::error::NvmlError; +use nvml_wrapper::{enum_wrappers::device::Clock, Device, Nvml}; use thiserror::Error; pub mod model; @@ -11,7 +11,7 @@ pub enum GpuDetectionError { #[error("a libloading error occurred: {0}")] LibloadingError(#[from] libloading::Error), #[error("an unknown error occurred: {0}")] - Unknown(String) + Unknown(String), } pub struct GpuDetection { @@ -24,11 +24,11 @@ impl GpuDetection { Ok(nvlm) => nvlm, Err(NvmlError::LibloadingError(e)) => { log::error!("GpuDetection library loading failed: {}", e); - return Err(GpuDetectionError::LibloadingError(e)) - }, + return Err(GpuDetectionError::LibloadingError(e)); + } Err(e) => { log::error!("GpuDetection init failed: {}", e); - return Err(GpuDetectionError::Unknown(e.to_string())) + return Err(GpuDetectionError::Unknown(e.to_string())); } }; Ok(Self { nvml }) diff --git a/src/offer_template.rs b/src/offer_template.rs index 0875bc4..d57f965 100644 --- a/src/offer_template.rs +++ b/src/offer_template.rs @@ -1,10 +1,10 @@ use crate::process::RuntimeConfig; use gpu_detection::model::Gpu; +use gpu_detection::GpuDetectionError; use serde::{Deserialize, Serialize}; use std::borrow::Cow; use std::collections::BTreeMap; -use gpu_detection::GpuDetectionError; #[derive(Deserialize, Serialize)] struct OfferTemplate { @@ -15,12 +15,10 @@ pub(crate) fn gpu_detection(config: &CONFIG) -> anyhow::R match gpu_detection::GpuDetection::init() { Ok(gpu_detection) => { let gpu = gpu_detection.detect(config.gpu_uuid())?; - return Ok(Some(gpu)); + Ok(Some(gpu)) } - Err(GpuDetectionError::LibloadingError(_)) => { - return Ok(None); - }, - Err(e) => Err(e.into()) + Err(GpuDetectionError::LibloadingError(_)) => Ok(None), + Err(e) => Err(e.into()), } }