33
44extern crate anyhow;
55extern crate encoding_rs;
6- use crate :: ascii_enc_label;
7- use crate :: chars_min_default;
8- use crate :: counter_offset_default;
9- use crate :: encoding_default;
106use crate :: input:: ByteCounter ;
117use crate :: options:: ARGS ;
8+ use crate :: options:: ASCII_ENC_LABEL ;
9+ use crate :: options:: CHARS_MIN_DEFAULT ;
10+ use crate :: options:: COUNTER_OFFSET_DEFAULT ;
11+ use crate :: options:: ENCODING_DEFAULT ;
12+ use crate :: options:: OUTPUT_LINE_CHAR_NB_MAX_DEFAULT ;
1213use crate :: options:: OUTPUT_LINE_CHAR_NB_MIN ;
13- use crate :: output_line_char_nb_max_default;
1414use anyhow:: { anyhow, Context , Result } ;
1515use encoding_rs:: * ;
1616use lazy_static:: lazy_static;
@@ -572,7 +572,7 @@ impl Missions {
572572 }
573573
574574 let mut v = Vec :: new ( ) ;
575- let encoding_default: & [ String ; 1 ] = & [ String :: from_str ( & * encoding_default ! ( ) ) . unwrap ( ) ] ;
575+ let encoding_default: & [ String ; 1 ] = & [ ENCODING_DEFAULT . to_string ( ) ] ;
576576
577577 let enc_iter = if flag_encoding. is_empty ( ) {
578578 encoding_default. iter ( )
@@ -588,12 +588,12 @@ impl Missions {
588588
589589 let mut enc_name = match enc_name {
590590 Some ( s) => s,
591- None => encoding_default ! ( ) ,
591+ None => ENCODING_DEFAULT ,
592592 } ;
593593
594594 let counter_offset = match flag_counter_offset {
595595 Some ( n) => n,
596- None => counter_offset_default ! ( ) ,
596+ None => COUNTER_OFFSET_DEFAULT ,
597597 } ;
598598
599599 // If `char_min_nb` is not defined in `enc_opt`
@@ -602,15 +602,15 @@ impl Missions {
602602 Some ( n) => n,
603603 None => match flag_chars_min_nb {
604604 Some ( n) => n,
605- None => chars_min_default ! ( ) ,
605+ None => CHARS_MIN_DEFAULT ,
606606 } ,
607607 } ;
608608
609609 let require_same_unicode_block = flag_same_unicode_block;
610610
611611 let output_line_char_nb_max = match flag_output_line_len {
612612 Some ( n) => n,
613- None => output_line_char_nb_max_default ! ( ) ,
613+ None => OUTPUT_LINE_CHAR_NB_MAX_DEFAULT ,
614614 } ;
615615
616616 if output_line_char_nb_max < OUTPUT_LINE_CHAR_NB_MIN {
@@ -628,16 +628,15 @@ impl Missions {
628628 // "x-user-defined" and the `UTF8_FILTER_ASCII_MODE_DEFAULT`-filter,
629629 // if not otherwise specified.
630630
631- let filter_af = filter_af . unwrap_or ( flag_ascii_filter . unwrap_or (
632- if enc_name == ascii_enc_label ! ( ) {
631+ let filter_af =
632+ filter_af . unwrap_or ( flag_ascii_filter . unwrap_or ( if enc_name == ASCII_ENC_LABEL {
633633 UTF8_FILTER_ASCII_MODE_DEFAULT . af
634634 } else {
635635 UTF8_FILTER_NON_ASCII_MODE_DEFAULT . af
636- } ,
637- ) ) ;
636+ } ) ) ;
638637
639638 let filter_ubf = filter_ubf. unwrap_or ( flag_unicode_block_filter. unwrap_or (
640- if enc_name == ascii_enc_label ! ( ) {
639+ if enc_name == ASCII_ENC_LABEL {
641640 UTF8_FILTER_ASCII_MODE_DEFAULT . ubf
642641 } else {
643642 UTF8_FILTER_NON_ASCII_MODE_DEFAULT . ubf
@@ -649,7 +648,7 @@ impl Missions {
649648 None => match flag_grep_char {
650649 Some ( f) => Some ( f) ,
651650 None => {
652- if enc_name == ascii_enc_label ! ( ) {
651+ if enc_name == ASCII_ENC_LABEL {
653652 UTF8_FILTER_ASCII_MODE_DEFAULT . grep_char
654653 } else {
655654 UTF8_FILTER_NON_ASCII_MODE_DEFAULT . grep_char
@@ -677,7 +676,7 @@ impl Missions {
677676 } ;
678677
679678 let mut print_encoding_as_ascii = false ;
680- if enc_name == ascii_enc_label ! ( ) {
679+ if enc_name == ASCII_ENC_LABEL {
681680 print_encoding_as_ascii = true ;
682681 enc_name = "x-user-defined"
683682 } ;
0 commit comments