on master help sign in
Implement trait Default for struct Config
7208a63Fahmi Akbar Wildana
src/lib.rs+7−1
@@ -65,12 +65,18 @@ pub enum PagingMode {
65 Never,
65 Never,
66}
66}
67
67
68+impl Default for PagingMode {
69+ fn default() -> Self {
70+ Self::Never
71+ }
72+}
73+
68use inputfile::InputFile;
74use inputfile::InputFile;
69use line_range::LineRanges;
75use line_range::LineRanges;
70use style::{OutputComponents, OutputWrap};
76use style::{OutputComponents, OutputWrap};
71use syntax_mapping::SyntaxMapping;
77use syntax_mapping::SyntaxMapping;
72
78
73−#[derive(Clone)]
79+#[derive(Clone, Default)]
74pub struct Config<'a> {
80pub struct Config<'a> {
75 /// List of files to print
81 /// List of files to print
76 pub files: Vec<InputFile<'a>>,
82 pub files: Vec<InputFile<'a>>,
src/line_range.rs+1−1
@@ -89,7 +89,7 @@ pub enum RangeCheckResult {
89 AfterLastRange,
89 AfterLastRange,
90}
90}
91
91
92−#[derive(Clone)]
92+#[derive(Clone, Default)]
93pub struct LineRanges {
93pub struct LineRanges {
94 ranges: Vec<LineRange>,
94 ranges: Vec<LineRange>,
95 largest_upper_bound: usize,
95 largest_upper_bound: usize,
src/style.rs+7−1
@@ -21,6 +21,12 @@ pub enum OutputWrap {
21 None,
21 None,
22}
22}
23
23
24+impl Default for OutputWrap {
25+ fn default() -> Self {
26+ Self::None
27+ }
28+}
29+
24impl OutputComponent {
30impl OutputComponent {
25 pub fn components(self, interactive_terminal: bool) -> &'static [OutputComponent] {
31 pub fn components(self, interactive_terminal: bool) -> &'static [OutputComponent] {
26 match self {
32 match self {
@@ -66,7 +72,7 @@ impl FromStr for OutputComponent {
66 }
72 }
67}
73}
68
74
69−#[derive(Clone)]
75+#[derive(Clone, Default)]
70pub struct OutputComponents(pub HashSet<OutputComponent>);
76pub struct OutputComponents(pub HashSet<OutputComponent>);
71
77
72impl OutputComponents {
78impl OutputComponents {