From 70a90a14655638cc23d92c9dae91a35271bf4016 Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Tue, 27 Jun 2023 14:04:20 +0200 Subject: [PATCH] Clippy without features. --- candle-hub/src/api.rs | 7 ++++++- candle-hub/src/lib.rs | 7 ++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/candle-hub/src/api.rs b/candle-hub/src/api.rs index 1df54e28..30af19c6 100644 --- a/candle-hub/src/api.rs +++ b/candle-hub/src/api.rs @@ -1,4 +1,4 @@ -use crate::{Cache, Repo, NAME, VERSION}; +use crate::{Cache, Repo}; use fs2::FileExt; use indicatif::{ProgressBar, ProgressStyle}; use rand::{distributions::Alphanumeric, thread_rng, Rng}; @@ -18,6 +18,11 @@ use thiserror::Error; use tokio::io::{AsyncSeekExt, AsyncWriteExt, SeekFrom}; use tokio::sync::{AcquireError, Semaphore, TryAcquireError}; +/// Current version (used in user-agent) +const VERSION: &str = env!("CARGO_PKG_VERSION"); +/// Current name (used in user-agent) +const NAME: &str = env!("CARGO_PKG_NAME"); + #[derive(Debug, Error)] /// All errors the API can throw pub enum ApiError { diff --git a/candle-hub/src/lib.rs b/candle-hub/src/lib.rs index ceac9718..fbfef5e7 100644 --- a/candle-hub/src/lib.rs +++ b/candle-hub/src/lib.rs @@ -15,11 +15,6 @@ use std::path::PathBuf; #[cfg(feature = "online")] pub mod api; -/// Current version (used in user-agent) -const VERSION: &str = env!("CARGO_PKG_VERSION"); -/// Current name (used in user-agent) -const NAME: &str = env!("CARGO_PKG_NAME"); - /// The type of repo to interact with #[derive(Debug, Clone, Copy)] pub enum RepoType { @@ -78,6 +73,7 @@ impl Cache { Ok(()) } + #[cfg(feature = "online")] pub(crate) fn blob_path(&self, repo: &Repo, etag: &str) -> PathBuf { let mut blob_path = self.path.clone(); blob_path.push(repo.folder_name()); @@ -111,6 +107,7 @@ impl Default for Cache { } /// The representation of a repo on the hub. +#[allow(dead_code)] // Repo type unused in offline mode pub struct Repo { repo_id: String, repo_type: RepoType,