mirror of
https://github.com/huggingface/candle.git
synced 2025-06-18 03:28:50 +00:00
Clippy without features.
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
use crate::{Cache, Repo, NAME, VERSION};
|
use crate::{Cache, Repo};
|
||||||
use fs2::FileExt;
|
use fs2::FileExt;
|
||||||
use indicatif::{ProgressBar, ProgressStyle};
|
use indicatif::{ProgressBar, ProgressStyle};
|
||||||
use rand::{distributions::Alphanumeric, thread_rng, Rng};
|
use rand::{distributions::Alphanumeric, thread_rng, Rng};
|
||||||
@ -18,6 +18,11 @@ use thiserror::Error;
|
|||||||
use tokio::io::{AsyncSeekExt, AsyncWriteExt, SeekFrom};
|
use tokio::io::{AsyncSeekExt, AsyncWriteExt, SeekFrom};
|
||||||
use tokio::sync::{AcquireError, Semaphore, TryAcquireError};
|
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)]
|
#[derive(Debug, Error)]
|
||||||
/// All errors the API can throw
|
/// All errors the API can throw
|
||||||
pub enum ApiError {
|
pub enum ApiError {
|
||||||
|
@ -15,11 +15,6 @@ use std::path::PathBuf;
|
|||||||
#[cfg(feature = "online")]
|
#[cfg(feature = "online")]
|
||||||
pub mod api;
|
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
|
/// The type of repo to interact with
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub enum RepoType {
|
pub enum RepoType {
|
||||||
@ -78,6 +73,7 @@ impl Cache {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "online")]
|
||||||
pub(crate) fn blob_path(&self, repo: &Repo, etag: &str) -> PathBuf {
|
pub(crate) fn blob_path(&self, repo: &Repo, etag: &str) -> PathBuf {
|
||||||
let mut blob_path = self.path.clone();
|
let mut blob_path = self.path.clone();
|
||||||
blob_path.push(repo.folder_name());
|
blob_path.push(repo.folder_name());
|
||||||
@ -111,6 +107,7 @@ impl Default for Cache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The representation of a repo on the hub.
|
/// The representation of a repo on the hub.
|
||||||
|
#[allow(dead_code)] // Repo type unused in offline mode
|
||||||
pub struct Repo {
|
pub struct Repo {
|
||||||
repo_id: String,
|
repo_id: String,
|
||||||
repo_type: RepoType,
|
repo_type: RepoType,
|
||||||
|
Reference in New Issue
Block a user