-
Notifications
You must be signed in to change notification settings - Fork 29
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
refactor code #70
base: main
Are you sure you want to change the base?
refactor code #70
Conversation
Sorry for not getting back to this. I've only had time to skim over the changes as there was lots of private and work related stuff going on. There are lots of nice improvements regarding the code and where I obviously didn't know about some functions or how to do it properly with Rust. I definitely want to understand what has been changed and incorporate things like this into the code. It's a bit much for one PR, so I have postponed properly checking it for forever. I hope in a few weeks from now I have more time for this project here again and will be able to get this code base and everything around it more polished into something that can be downloaded and used. |
I am also working on similar changes using
|
@@ -34,26 +68,14 @@ impl Diff for Field { | |||
|
|||
impl std::fmt::Display for Field { | |||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | |||
let password_str = match (self.mask_passwords, self.kind) { | |||
(true, ValueType::Protected) => "***", | |||
_ => self.value.as_str(), |
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.
Can be written as follows:
- _ => self.value.as_str(),
+ _ => &self.value,
} | ||
|
||
pub fn value(&self) -> &str { | ||
self.value.as_str() |
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.
Can be written as follows:
- self.value.as_str(),
+ &self.value,
While debugging a problem (which turns out to be caused by my password manager) I just started to refactor the code to make it easier to read and understand.
The main changes are:
Stack
bystd::vec::Vec
Not sure if you want any of those changes. In case you only want some of them I can also revert the others.