-
Notifications
You must be signed in to change notification settings - Fork 42
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
[rust] improvements in agama logs store #1762
base: master
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 11998061439Details
💛 - Coveralls |
0a2c147
to
aad639b
Compare
And removed some which are not existing anymore. Like /var/log/zypper/ dir.
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.
It looking much better now. Thanks!
@@ -143,7 +145,22 @@ impl LogItem for LogPath { | |||
let options = CopyOptions::new(); | |||
// fs_extra's own Error doesn't implement From trait so ? operator is unusable | |||
match copy_items(&[self.src_path.as_str()], dst_path, &options) { | |||
Ok(_p) => Ok(()), | |||
Ok(_p) => { |
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.
One match and three nested "ifs" look too much to me :-) What about something like:
copy_items(&[self.src_path.as_str()], dst_path, &options)
.map_err(|_e| io::Error::new(io::ErrorKind::Other, "Copying of a file failed"))?;
if let Some(file_name) = dst_file.file_name().and_then(|fname| fname.to_str()) {
if file_name.starts_with(".") {
let name = file_name.trim_start_matches(".");
let _ = fs::rename(dst_file.clone(), dst_file.with_file_name(name));
}
}
Ok(())
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.
you're suppressing my creativity ;-)
I'll look into it ...
Problem
Solution
Testing