Skip to content

Commit a3c7c4b

Browse files
committed
refactor: remove parent parser mod
1 parent 3052d6a commit a3c7c4b

17 files changed

+40
-49
lines changed

examples/parser_file_in_file_out.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::{
1010
io::{Read, Write},
1111
};
1212

13-
use bencode2json::parsers::generators::json::BencodeParser;
13+
use bencode2json::generators::json::BencodeParser;
1414
use clap::{Arg, Command};
1515

1616
fn main() {

examples/parser_stdin_stdout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! It prints "spam".
88
use std::io;
99

10-
use bencode2json::parsers::generators::json::BencodeParser;
10+
use bencode2json::generators::json::BencodeParser;
1111

1212
fn main() {
1313
let input = Box::new(io::stdin());

examples/parser_string_in_string_out.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! ```
66
//!
77
//! It prints "spam".
8-
use bencode2json::parsers::generators::json::BencodeParser;
8+
use bencode2json::generators::json::BencodeParser;
99

1010
fn main() {
1111
let input = "4:spam".to_string();

examples/parser_string_in_vec_out.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! ```
66
//!
77
//! It prints "spam".
8-
use bencode2json::parsers::generators::json::BencodeParser;
8+
use bencode2json::generators::json::BencodeParser;
99

1010
fn main() {
1111
let input = "4:spam".to_string();

examples/parser_vec_in_string_out.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! ```
66
//!
77
//! It prints "spam".
8-
use bencode2json::parsers::generators::json::BencodeParser;
8+
use bencode2json::generators::json::BencodeParser;
99

1010
fn main() {
1111
let input = b"4:spam".to_vec();

examples/parser_vec_in_vec_out.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! ```
66
//!
77
//! It prints "spam".
8-
use bencode2json::parsers::generators::json::BencodeParser;
8+
use bencode2json::generators::json::BencodeParser;
99

1010
fn main() {
1111
let input = b"4:spam".to_vec();
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ impl fmt::Display for WriteContext {
197197
mod tests {
198198

199199
mod for_read_context {
200-
use crate::parsers::error::ReadContext;
200+
use crate::error::ReadContext;
201201

202202
#[test]
203203
fn it_should_display_the_read_context() {
@@ -237,7 +237,7 @@ mod tests {
237237
}
238238

239239
mod for_write_context {
240-
use crate::parsers::error::WriteContext;
240+
use crate::error::WriteContext;
241241

242242
#[test]
243243
fn it_should_display_the_read_context() {
Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ use super::{
1717
use tokenizer::{BencodeToken, Tokenizer};
1818

1919
use crate::{
20-
parsers::{
21-
error::{self, ReadContext, WriteContext},
22-
tokenizer,
23-
},
20+
error::{self, ReadContext, WriteContext},
2421
rw::{byte_writer::ByteWriter, string_writer::StringWriter, writer::Writer},
22+
tokenizer,
2523
};
2624

2725
pub struct BencodeParser<R: Read> {
@@ -355,10 +353,10 @@ mod tests {
355353

356354
use std::io::{self, Read};
357355

358-
use crate::parsers::generators::json::BencodeParser;
356+
use crate::generators::json::BencodeParser;
359357

360358
mod it_should_allow_writing {
361-
use crate::parsers::generators::json::BencodeParser;
359+
use crate::generators::json::BencodeParser;
362360

363361
#[test]
364362
fn to_any_type_implementing_io_write_trait() {
@@ -411,7 +409,7 @@ mod tests {
411409

412410
mod it_should_allow_special_bencode_cases {
413411

414-
use crate::{parsers::generators::json::BencodeParser, test::bencode_to_json_unchecked};
412+
use crate::{generators::json::BencodeParser, test::bencode_to_json_unchecked};
415413

416414
#[test]
417415
fn an_empty_input() {
@@ -448,10 +446,7 @@ mod tests {
448446
mod it_should_fail {
449447
use std::io::{self, Read};
450448

451-
use crate::{
452-
parsers::{error::Error, generators::json::BencodeParser},
453-
try_bencode_to_json,
454-
};
449+
use crate::{error::Error, generators::json::BencodeParser, try_bencode_to_json};
455450

456451
#[test]
457452
fn when_there_is_a_problem_reading_from_input() {
@@ -548,7 +543,7 @@ mod tests {
548543
}
549544

550545
mod should_fail {
551-
use crate::{parsers::error::Error, try_bencode_to_json};
546+
use crate::{error::Error, try_bencode_to_json};
552547

553548
#[test]
554549
fn when_it_finds_an_invalid_byte() {
@@ -754,7 +749,7 @@ mod tests {
754749
}
755750

756751
mod it_should_fail_parsing_when {
757-
use crate::{parsers::error::Error, try_bencode_to_json};
752+
use crate::{error::Error, try_bencode_to_json};
758753

759754
#[test]
760755
fn it_reaches_the_end_of_the_input_parsing_the_string_length() {
@@ -1327,7 +1322,7 @@ mod tests {
13271322
}
13281323

13291324
mod should_fail {
1330-
use crate::{parsers::error::Error, try_bencode_to_json};
1325+
use crate::{error::Error, try_bencode_to_json};
13311326

13321327
#[test]
13331328
fn when_an_empty_list_does_not_have_the_matching_close_byte() {
@@ -1920,7 +1915,7 @@ mod tests {
19201915
}
19211916

19221917
mod should_fail {
1923-
use crate::{parsers::error::Error, try_bencode_to_json};
1918+
use crate::{error::Error, try_bencode_to_json};
19241919

19251920
#[test]
19261921
fn when_an_empty_dict_does_not_have_the_matching_close_byte() {
@@ -1998,8 +1993,8 @@ mod tests {
19981993
}
19991994

20001995
mod when_the_field_key_is_not_a_string_for_example {
2001-
use crate::parsers::error::Error;
2002-
use crate::parsers::generators::json::BencodeType;
1996+
use crate::error::Error;
1997+
use crate::generators::json::BencodeType;
20031998
use crate::try_bencode_to_json;
20041999

20052000
#[test]
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl Stack {
150150
#[cfg(test)]
151151
mod tests {
152152
mod the_stack_state {
153-
use crate::parsers::generators::stack::State;
153+
use crate::generators::stack::State;
154154

155155
#[test]
156156
fn should_be_displayed_with_single_letter_abbreviations() {
@@ -165,7 +165,7 @@ mod tests {
165165

166166
mod the_stack {
167167
mod it_should {
168-
use crate::parsers::generators::stack::{Stack, State};
168+
use crate::generators::stack::{Stack, State};
169169

170170
#[test]
171171
fn have_an_initial_state() {
@@ -235,7 +235,7 @@ mod tests {
235235

236236
mod be_displayed_with_single_letter_abbreviations_for_states {
237237

238-
use crate::parsers::generators::stack::{Stack, State};
238+
use crate::generators::stack::{Stack, State};
239239

240240
#[test]
241241
fn with_the_initial_state() {

0 commit comments

Comments
 (0)