on master help sign in
Implement trait Default for struct Config
commit7208a63a496fce38bbe2eae9f6d13fce5eac562a authorFahmi Akbar Wildana <f.a.wildana@gmail.com> dateTue 15 Oct 2019, 08:18 (7 years ago) parent0273848
3 files changed+15−3
src/lib.rs+7−1 src/line_range.rs+1−1 src/style.rs+7−1
src/lib.rs+7−1
@@ -65,12 +65,18 @@ pub enum PagingMode {
6565 Never,
6666}
6767
68+impl Default for PagingMode {
69+ fn default() -> Self {
70+ Self::Never
71+ }
72+}
73+
6874use inputfile::InputFile;
6975use line_range::LineRanges;
7076use style::{OutputComponents, OutputWrap};
7177use syntax_mapping::SyntaxMapping;
7278
73−#[derive(Clone)]
79+#[derive(Clone, Default)]
7480pub struct Config<'a> {
7581 /// List of files to print
7682 pub files: Vec<InputFile<'a>>,
src/line_range.rs+1−1
@@ -89,7 +89,7 @@ pub enum RangeCheckResult {
8989 AfterLastRange,
9090}
9191
92−#[derive(Clone)]
92+#[derive(Clone, Default)]
9393pub struct LineRanges {
9494 ranges: Vec<LineRange>,
9595 largest_upper_bound: usize,
src/style.rs+7−1
@@ -21,6 +21,12 @@ pub enum OutputWrap {
2121 None,
2222}
2323
24+impl Default for OutputWrap {
25+ fn default() -> Self {
26+ Self::None
27+ }
28+}
29+
2430impl OutputComponent {
2531 pub fn components(self, interactive_terminal: bool) -> &'static [OutputComponent] {
2632 match self {
@@ -66,7 +72,7 @@ impl FromStr for OutputComponent {
6672 }
6773}
6874
69−#[derive(Clone)]
75+#[derive(Clone, Default)]
7076pub struct OutputComponents(pub HashSet<OutputComponent>);
7177
7278impl OutputComponents {