Skip to content

Commit

Permalink
update imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-cbo authored and rubdos committed Jul 7, 2024
1 parent ef03f93 commit a9f6879
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 29 deletions.
19 changes: 8 additions & 11 deletions src/metadata/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,21 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::error;
use crate::metadata::loader;
use crate::Metadata;
use bincode;
use bincode::Options;
use fnv::FnvHashMap;
use once_cell::sync::Lazy;
use regex_cache::{CachedRegex, CachedRegexBuilder, RegexCache};
use std::borrow::Borrow;
use std::fs::File;
use std::hash::Hash;
use std::io::{BufReader, Cursor};
use std::path::Path;
use std::sync::{Arc, Mutex};

use once_cell::sync::Lazy;

use bincode;
use bincode::Options;
use fnv::FnvHashMap;
use regex_cache::{CachedRegex, CachedRegexBuilder, RegexCache};

use crate::error;
use crate::metadata::loader;
use crate::Metadata;

const DATABASE: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/database.bin"));

/// The Google provided metadata database, used as default.
Expand Down
18 changes: 8 additions & 10 deletions src/parser/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,22 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::consts;
use crate::country;
use crate::error;
use crate::metadata::{Database, Metadata};
use crate::phone_number::Type;
use crate::validator;
use fnv::FnvHashMap;
use nom::{
character::complete::*,
combinator::*,
error::{make_error, ErrorKind},
multi::*,
AsChar, IResult,
};
use std::borrow::Cow;

use fnv::FnvHashMap;
use regex_cache::CachedRegex;

use crate::consts;
use crate::country;
use crate::error;
use crate::metadata::{Database, Metadata};
use crate::phone_number::Type;
use crate::validator;
use std::borrow::Cow;

macro_rules! parse {
($input:ident => ) => ();
Expand Down
1 change: 0 additions & 1 deletion src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use crate::metadata::{Database, DATABASE};
use crate::national_number::NationalNumber;
use crate::phone_number::{PhoneNumber, Type};
use crate::validator::{self, Validation};

use nom::{branch::alt, IResult};

#[macro_use]
Expand Down
5 changes: 2 additions & 3 deletions src/parser/natural.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use nom::error::ErrorKind;
use nom::IResult;

use crate::consts;
use crate::parser::helper::*;
use nom::error::ErrorKind;
use nom::IResult;

pub fn phone_number(i: &str) -> IResult<&str, Number<'_>> {
let (_, i) = extract(i)?;
Expand Down
3 changes: 1 addition & 2 deletions src/parser/rfc3966.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::parser::helper::*;
use fnv::FnvHashMap;
use nom::{
bytes::complete::*,
Expand All @@ -22,8 +23,6 @@ use nom::{
AsChar, IResult,
};

use crate::parser::helper::*;

pub fn phone_number(i: &str) -> IResult<&str, Number<'_>> {
parse! { i =>
opt(tag_no_case("Tel:"));
Expand Down
3 changes: 1 addition & 2 deletions src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use either::*;

use crate::consts;
use crate::country;
use crate::metadata::{Database, Metadata, DATABASE};
use crate::parser;
use crate::parser::helper::Number as ParseNumber;
use crate::phone_number::{PhoneNumber, Type};
use either::*;

/// Possible outcomes when testing if a `PhoneNumber` is possible.
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
Expand Down

0 comments on commit a9f6879

Please sign in to comment.