-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MRG: adjust Signature::name()
to return Option<String>
instead of filename()
and md5sum()
#3434
Changes from 12 commits
2e63b1b
5cf7c72
f1b889c
3cc41a1
1dccd2c
f5974ef
8a9d657
c84565c
11db611
d2300b7
c0165bd
0f006e1
34dba54
6ad32c1
0ed80c1
2c7a070
e910e7c
6b6df75
9f0702d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -448,10 +448,8 @@ impl Signature { | |
pub fn name(&self) -> String { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ooh, I like it! let me give it a try 🙇 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if let Some(name) = &self.name { | ||
name.clone() | ||
} else if let Some(filename) = &self.filename { | ||
filename.clone() | ||
} else { | ||
self.md5sum() | ||
"".into() | ||
} | ||
} | ||
|
||
|
@@ -982,6 +980,8 @@ mod test { | |
assert_eq!(sig.signatures[0].size(), 3); | ||
assert_eq!(sig.signatures[1].size(), 2); | ||
assert_eq!(sig.signatures[2].size(), 1); | ||
|
||
assert_eq!(sig.name(), ""); | ||
} | ||
|
||
#[test] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ugly - is there an idiomatic way to do this??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yuck: https://stackoverflow.com/questions/45343320/how-can-i-return-the-first-non-empty-string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeh.... :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in 0ed80c1