fixed compilation on some obscurish architectures (e.g. powerpc), more clippy lints
This commit is contained in:
parent
7115692f9d
commit
25c9efa2f1
8 changed files with 28 additions and 9 deletions
|
@ -26,7 +26,6 @@ xdg-mime-backend = []
|
|||
[dependencies]
|
||||
walkdir = "2.3.1"
|
||||
log = "0.4.14"
|
||||
smartstring = "0.2.6"
|
||||
mime_guess = "2.0.3"
|
||||
snailquote = "0.3.0"
|
||||
once_cell = "1.5.2"
|
||||
|
@ -38,6 +37,9 @@ cfg-if = "1.0.0"
|
|||
[target.'cfg(unix)'.dependencies]
|
||||
xdg-mime = "0.3"
|
||||
|
||||
[target.'cfg(not(all(target_endian = "big", target_pointer_width = "32")))'.dependencies]
|
||||
smartstring = "0.2.6"
|
||||
|
||||
[patch.crates-io]
|
||||
# use git version while waiting on a release incorporating https://github.com/ebassi/xdg-mime-rs/commit/de5a6dd
|
||||
xdg-mime = {git = "https://github.com/ebassi/xdg-mime-rs", version = "0.3", rev = "de5a6dd" }
|
||||
|
|
|
@ -6,6 +6,11 @@ cargo clippy --tests -- \
|
|||
-W clippy::pedantic \
|
||||
-W clippy::complexity \
|
||||
-W clippy::cargo \
|
||||
-W clippy::float_cmp_const \
|
||||
-W clippy::lossy_float_literal \
|
||||
-W clippy::multiple_inherent_impl \
|
||||
-W clippy::string_to_string \
|
||||
-W clippy::wrong_pub_self_convention \
|
||||
-A clippy::unused_io_amount \
|
||||
-A clippy::redundant_closure_for_method_calls \
|
||||
-A clippy::shadow_unrelated
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::path::Path;
|
||||
|
||||
use crate::string_type::String;
|
||||
use mime_guess::Mime;
|
||||
use smartstring::alias::String;
|
||||
|
||||
use crate::inspectors::mime_extension_lookup;
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ use std::str::FromStr;
|
|||
|
||||
use cached::cached;
|
||||
use mime_guess::Mime;
|
||||
use smartstring::alias::String;
|
||||
|
||||
use crate::mime_db::MimeDb;
|
||||
use crate::string_type::String;
|
||||
|
||||
/// The number of bytes to read initially.
|
||||
///
|
||||
|
|
|
@ -41,6 +41,7 @@ mod inspectors;
|
|||
mod mime_db;
|
||||
mod parameters;
|
||||
mod scan_error;
|
||||
pub(crate) mod string_type;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
//! [Clap] struct used to parse command line arguments.
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::extension_set::ExtensionSet;
|
||||
use crate::string_type::String as StringType;
|
||||
use cfg_if::cfg_if;
|
||||
use clap::{AppSettings, Clap};
|
||||
use smartstring::{LazyCompact, SmartString};
|
||||
use std::path::PathBuf;
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(windows)] {
|
||||
|
@ -50,7 +49,7 @@ pub struct Parameters {
|
|||
require_delimiter = true,
|
||||
required_unless_present = "ext-set"
|
||||
)]
|
||||
pub exts: Option<Vec<SmartString<LazyCompact>>>,
|
||||
pub exts: Option<Vec<StringType>>,
|
||||
|
||||
/// Use a preset list of extensions as the search filter
|
||||
#[clap(short = 'E', long, arg_enum, required_unless_present = "exts")]
|
||||
|
|
11
src/string_type.rs
Normal file
11
src/string_type.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
use cfg_if::cfg_if;
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(not(all(target_endian = "big", target_pointer_width = "32")))] {
|
||||
// most architectures
|
||||
pub use smartstring::alias::String;
|
||||
} else {
|
||||
// powerpc
|
||||
pub use std::string::String;
|
||||
}
|
||||
}
|
|
@ -1,12 +1,13 @@
|
|||
use crate::inspectors::{mime_extension_lookup, BUF_SIZE};
|
||||
use crate::{extension_from_path, init_db, scan_directory, scan_from_walkdir};
|
||||
|
||||
use crate::parameters::{Parameters, ScanOpts};
|
||||
use crate::mime_db::MimeDb;
|
||||
use crate::parameters::{Parameters, ScanOpts};
|
||||
use crate::string_type::String;
|
||||
use cfg_if::cfg_if;
|
||||
use mime_guess::mime::{APPLICATION_OCTET_STREAM, APPLICATION_PDF, IMAGE_JPEG, IMAGE_PNG};
|
||||
use mime_guess::Mime;
|
||||
use smartstring::alias::String;
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::OsStr;
|
||||
|
|
Loading…
Reference in a new issue