mirror of
https://git.proxmox.com/git/pmg-log-tracker
synced 2025-07-16 19:17:23 +00:00
tree wide cargo fmt
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
8f1719eebe
commit
ddaa372402
29
src/main.rs
29
src/main.rs
@ -1842,11 +1842,7 @@ impl Parser {
|
|||||||
let line = &buffer[0..size - 1];
|
let line = &buffer[0..size - 1];
|
||||||
let complete_line = line;
|
let complete_line = line;
|
||||||
|
|
||||||
let (time, line) = match parse_time(
|
let (time, line) = match parse_time(line, self.current_year, self.current_month) {
|
||||||
line,
|
|
||||||
self.current_year,
|
|
||||||
self.current_month,
|
|
||||||
) {
|
|
||||||
Some(t) => t,
|
Some(t) => t,
|
||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
@ -1918,7 +1914,6 @@ impl Parser {
|
|||||||
let mut buffer = Vec::new();
|
let mut buffer = Vec::new();
|
||||||
|
|
||||||
for (i, item) in LOGFILES.iter().enumerate() {
|
for (i, item) in LOGFILES.iter().enumerate() {
|
||||||
|
|
||||||
count = i;
|
count = i;
|
||||||
if let Ok(file) = File::open(item) {
|
if let Ok(file) = File::open(item) {
|
||||||
self.current_file_index = i;
|
self.current_file_index = i;
|
||||||
@ -1931,11 +1926,9 @@ impl Parser {
|
|||||||
if size == 0 {
|
if size == 0 {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
if let Some((time, _)) = parse_time(
|
if let Some((time, _)) =
|
||||||
&buffer[0..size],
|
parse_time(&buffer[0..size], self.current_year, self.current_month)
|
||||||
self.current_year,
|
{
|
||||||
self.current_month,
|
|
||||||
) {
|
|
||||||
// found the earliest file in the time frame
|
// found the earliest file in the time frame
|
||||||
if time < self.options.start {
|
if time < self.options.start {
|
||||||
break;
|
break;
|
||||||
@ -1950,11 +1943,9 @@ impl Parser {
|
|||||||
if size == 0 {
|
if size == 0 {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
if let Some((time, _)) = parse_time(
|
if let Some((time, _)) =
|
||||||
&buffer[0..size],
|
parse_time(&buffer[0..size], self.current_year, self.current_month)
|
||||||
self.current_year,
|
{
|
||||||
self.current_month,
|
|
||||||
) {
|
|
||||||
if time < self.options.start {
|
if time < self.options.start {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2250,11 +2241,7 @@ fn parse_number(data: &[u8], max_digits: usize) -> Option<(usize, &[u8])> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Parse time. Returns a tuple of (parsed_time, remaining_text) or None.
|
/// Parse time. Returns a tuple of (parsed_time, remaining_text) or None.
|
||||||
fn parse_time<'a>(
|
fn parse_time<'a>(data: &'a [u8], cur_year: i64, cur_month: i64) -> Option<(time_t, &'a [u8])> {
|
||||||
data: &'a [u8],
|
|
||||||
cur_year: i64,
|
|
||||||
cur_month: i64,
|
|
||||||
) -> Option<(time_t, &'a [u8])> {
|
|
||||||
if data.len() < 15 {
|
if data.len() < 15 {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
@ -26,4 +26,3 @@ fn after_queue_time_change_string() {
|
|||||||
let output_reader = BufReader::new(&output.stdout[..]);
|
let output_reader = BufReader::new(&output.stdout[..]);
|
||||||
utils::compare_output(output_reader, expected_output);
|
utils::compare_output(output_reader, expected_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user