Skip to content

Commit

Permalink
clean use import
Browse files Browse the repository at this point in the history
- merging use instruction with same root.
- bring closer super and crate use import.
  • Loading branch information
gwen-lg committed May 16, 2024
1 parent 7b6b6b9 commit d65743a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
10 changes: 5 additions & 5 deletions src/vobsub/idx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
use log::trace;
use once_cell::sync::Lazy;
use regex::Regex;
use std::fs;
use std::io;
use std::io::prelude::*;
use std::io::BufReader;
use std::path::Path;
use std::{
fs,
io::{self, prelude::*, BufReader},
path::Path,
};

use super::{palette, sub, IResultExt, Palette, VobSubError};

Expand Down
10 changes: 6 additions & 4 deletions src/vobsub/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ mod palette;
mod probe;
mod sub;

pub use self::idx::{read_palette, Index};
pub use self::palette::{palette, Palette};
pub use self::probe::{is_idx_file, is_sub_file};
pub use self::sub::{subtitles, ErrorMissing, Subtitle, Subtitles};
pub use self::{
idx::{read_palette, Index},
palette::{palette, Palette},
probe::{is_idx_file, is_sub_file},
sub::{subtitles, ErrorMissing, Subtitle, Subtitles},
};

use crate::content::ContentError;
use nom::{IResult, Needed};
Expand Down
3 changes: 1 addition & 2 deletions src/vobsub/mpeg2/clock.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use std::fmt;

use nom::{
bits::complete::{tag, take},
sequence::Tuple,
IResult,
};
use std::fmt;

/// This represents the 90kHz, 33-bit [System Time Clock][STC] (STC) and
/// the 9-bit STC extension value, which represents 1/300th of a tick.
Expand Down
7 changes: 4 additions & 3 deletions src/vobsub/mpeg2/ps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ use nom::{
};
use std::fmt;

use super::{
clock::{clock_and_ext, Clock},
pes,
};
use crate::vobsub::{NomError, VobSubError};

use super::clock::{clock_and_ext, Clock};
use super::pes;

/// A parsed [MPEG-2 Program Stream header][MPEG-PS] (MPEG-PS).
///
/// [MPEG-PS]: https://en.wikipedia.org/wiki/MPEG_program_stream
Expand Down
4 changes: 1 addition & 3 deletions src/vobsub/probe.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
//! Try to guess the types of files on disk.

use super::VobSubError;
use std::fs;
use std::io::Read;
use std::path::Path;
use std::{fs, io::Read, path::Path};

/// Internal helper function which looks for "magic" bytes at the start of
/// a file.
Expand Down
8 changes: 3 additions & 5 deletions src/vobsub/sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//! [subs]: http://sam.zoy.org/writings/dvd/subtitles/

use cast;
use image::{ImageBuffer, Rgba, RgbaImage};
use log::{trace, warn};
use nom::{
bits::{bits, complete::take as take_bits},
Expand All @@ -18,17 +19,14 @@ use nom::{
IResult,
};
use std::{cmp::Ordering, fmt};
use thiserror::Error;

use super::mpeg2::ps;
use super::Palette;
use super::{img::decompress, VobSubError};
use super::{img::decompress, mpeg2::ps, Palette, VobSubError};
use crate::{
content::{Area, AreaValues},
util::BytesFormatter,
vobsub::IResultExt,
};
use image::{ImageBuffer, Rgba, RgbaImage};
use thiserror::Error;

/// The default time between two adjacent subtitles if no end time is
/// provided. This is chosen to be a value that's usually representable in
Expand Down

0 comments on commit d65743a

Please sign in to comment.