mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-06-03 16:00:49 +00:00
002080cde8
This commit fixes a couple of Clippy warnings, and adds the list of lints we're OK with. It does raise some important warnings, such as those to do with casting, which aren't allowed so they can be fixed later.
31 lines
731 B
Rust
31 lines
731 B
Rust
use std::time::SystemTime;
|
|
|
|
use datetime::TimeZone;
|
|
use ansi_term::Style;
|
|
|
|
use crate::output::cell::TextCell;
|
|
use crate::output::time::TimeFormat;
|
|
|
|
|
|
pub trait Render {
|
|
fn render(self, style: Style, tz: &Option<TimeZone>, format: TimeFormat) -> TextCell;
|
|
}
|
|
|
|
impl Render for Option<SystemTime> {
|
|
fn render(self, style: Style, tz: &Option<TimeZone>, format: TimeFormat) -> TextCell {
|
|
let datestamp = if let Some(time) = self {
|
|
if let Some(ref tz) = tz {
|
|
format.format_zoned(time, tz)
|
|
}
|
|
else {
|
|
format.format_local(time)
|
|
}
|
|
}
|
|
else {
|
|
String::from("-")
|
|
};
|
|
|
|
TextCell::paint(style, datestamp)
|
|
}
|
|
}
|