change default formatting to use tabs instead of spaces

This commit is contained in:
chaos 2023-10-19 17:22:01 +01:00
parent 1dc74c2cb0
commit 2f5f493f9b
No known key found for this signature in database
38 changed files with 2118 additions and 2126 deletions

2
.rustfmt.toml Normal file
View file

@ -0,0 +1,2 @@
hard_tabs = true
use_field_init_shorthand = true

View file

@ -1,12 +1,8 @@
mod ffprobe_output;
pub mod errors;
mod ffprobe_output;
pub mod types;
use std::{
convert::Into,
path::Path,
process::Command,
};
use std::{convert::Into, path::Path, process::Command};
use self::errors::{AnalyzeError, FFProbeError};

View file

@ -3,10 +3,9 @@ use std::path::PathBuf;
use crate::{
types::{AudioFileInfo, ReplayGainRawData, Tags},
utils::format_detection::FileFormat,
utils::formats::{FormatHandler, AudioFormatError, BoxedError}
utils::formats::{AudioFormatError, BoxedError, FormatHandler},
};
pub struct FLACAudioFormat {
flac_tags: metaflac::Tag,
path: Box<PathBuf>,

View file

@ -5,7 +5,7 @@ use id3::TagLike;
use crate::{
types::{AudioFileInfo, ReplayGainRawData, Tags},
utils::format_detection::FileFormat,
utils::formats::{FormatHandler, AudioFormatError, BoxedError},
utils::formats::{AudioFormatError, BoxedError, FormatHandler},
};
pub struct ID3AudioFormat {

View file

@ -6,14 +6,14 @@ use lazy_static::lazy_static;
use super::{BoxedError, FormatHandler};
#[cfg(feature = "flac_extractor")]
mod flac;
#[cfg(feature = "ffprobe_extractor")]
mod ffprobe;
#[cfg(feature = "taglib_extractor")]
mod taglib;
#[cfg(feature = "flac_extractor")]
mod flac;
#[cfg(feature = "mp3_extractor")]
mod id3;
#[cfg(feature = "taglib_extractor")]
mod taglib;
type NewHandlerFuncReturn = Result<Box<dyn FormatHandler>, BoxedError>;
type NewHandlerFunc = fn(path: &PathBuf, file_format: Option<FileFormat>) -> NewHandlerFuncReturn;
@ -21,7 +21,7 @@ type NewHandlerFunc = fn(path: &PathBuf, file_format: Option<FileFormat>) -> New
pub struct Handler {
pub supported_extensions: Vec<String>,
pub supported_formats: Vec<FileFormat>,
pub new: NewHandlerFunc
pub new: NewHandlerFunc,
}
lazy_static! {
@ -37,7 +37,6 @@ lazy_static! {
extensions
};
pub static ref SUPPORTED_FORMATS: Vec<FileFormat> = {
let mut formats: Vec<FileFormat> = Vec::new();
for handler in HANDLERS.iter() {
@ -50,7 +49,6 @@ lazy_static! {
formats
};
pub static ref HANDLERS: Vec<Handler> = {
let mut handlers: Vec<Handler> = Vec::new();

View file

@ -9,10 +9,9 @@ use taglib::{
use crate::{
types::{AudioFileInfo, ReplayGainRawData, Tags},
utils::format_detection::FileFormat,
utils::formats::{FormatHandler, AudioFormatError, BoxedError}
utils::formats::{AudioFormatError, BoxedError, FormatHandler},
};
pub struct TaglibAudioFormat {
file: taglib::TagLibFile,
file_format: Option<FileFormat>,
@ -75,8 +74,7 @@ impl FormatHandler for TaglibAudioFormat {
FileFormat::OggVorbis
| FileFormat::OggOpus
| FileFormat::OggFLAC
| FileFormat::OggSpeex
// Both "support" ReplayGain but not implemented yet
| FileFormat::OggSpeex // Both "support" ReplayGain but not implemented yet
// FileFormat::Wav |
// FileFormat::WavPack
);

View file

@ -7,7 +7,6 @@ use thiserror::Error;
use crate::types::{AudioFileInfo, File, ReplayGainRawData, Tags};
use super::format_detection::detect_format;
type BoxedError = Box<dyn Error>;
@ -43,11 +42,11 @@ pub fn get_format_handler(file: &File) -> Result<Box<dyn FormatHandler>, BoxedEr
for handler in handlers::HANDLERS.iter() {
if !handler.supported_extensions.contains(&file.extension) {
continue
continue;
}
if !handler.supported_formats.contains(&format) {
continue
continue;
}
let new = handler.new;

View file

@ -1,11 +1,11 @@
pub mod ascii_reduce;
pub mod ffprobe;
pub mod format_detection;
pub mod replaygain;
pub mod transcoder;
pub mod ffprobe;
pub mod formats;
mod music_scanner;
mod music_scanner;
pub use formats::is_supported_file;
pub use music_scanner::scan_for_music;

View file

@ -3,5 +3,5 @@ pub mod progress_monitor;
#[allow(clippy::all)]
mod transcoder;
pub mod types;
use self::progress_monitor::progress_monitor;
use self::progress_monitor::progress_monitor;
pub use self::transcoder::transcode;