Skip to content

Commit

Permalink
impl from trait for InfoFieldOff
Browse files Browse the repository at this point in the history
  • Loading branch information
o2sh committed Aug 7, 2022
1 parent d562e86 commit 8e0450d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/info/info_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ pub struct InfoFieldOff {
pub license: bool,
}

impl InfoFieldOff {
pub fn from_info_fields(fields_to_hide: &[InfoField]) -> Self {
// TODO Implement using From trait instead?
impl From<&Vec<InfoField>> for InfoFieldOff {
fn from(fields_to_hide: &Vec<InfoField>) -> Self {
let mut info_field_off = InfoFieldOff {
..Default::default()
};
Expand Down
2 changes: 1 addition & 1 deletion src/info/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl Info {
true_color,
);
let text_colors = TextColors::new(&config.text_colors, ascii_colors[0]);
let disabled_fields = InfoFieldOff::from_info_fields(&config.disabled_fields);
let disabled_fields = InfoFieldOff::from(&config.disabled_fields);

Ok(Self {
git_username,
Expand Down

0 comments on commit 8e0450d

Please sign in to comment.