Skip to content

Commit

Permalink
src/ fix clippy warnings unused vars
Browse files Browse the repository at this point in the history
Fix clippy warnings about unused vars in LineReader
and SyslineReader.
  • Loading branch information
jtmoon79 committed Mar 29, 2023
1 parent b3189a5 commit 1fdef28
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
24 changes: 11 additions & 13 deletions src/readers/linereader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ impl LineReader {
// if line is terminated by end-of-file then "points" to last char of file.
let mut fo_nl_b: FileOffset = fileoffset;
// BlockIndex NewLine B
let mut bi_nl_b: BlockIndex;
//let mut bi_nl_b: BlockIndex;
// NewLine B EOF?
// was newline B actually the end of file?
let mut nl_b_eof: bool = false;
Expand Down Expand Up @@ -945,9 +945,9 @@ impl LineReader {
if (*bptr_middle)[bi_at] == NLu8 {
found_nl_b = true;
fo_nl_b = self.file_offset_at_block_offset_index(bo_middle, bi_at);
bi_nl_b = bi_at;
//bi_nl_b = bi_at;
bi_middle_end = bi_at;
defo!("B1: bi_middle_end {:?} bi_nl_b {:?} fo_nl_b {:?}", bi_middle_end, bi_nl_b, fo_nl_b);
defo!("B1: bi_middle_end {:?} fo_nl_b {:?}", bi_middle_end, fo_nl_b);
defo!(
"B1: found newline B in middle block during byte search, blockoffset {} blockindex {} (fileoffset {}) {:?}",
bo_middle,
Expand All @@ -969,12 +969,11 @@ impl LineReader {
debug_assert_ge!(bi_at, charsz_bi, "blockindex begin {} is less than charsz {} before attempt to subtract to determine newline B1 at end of file for file {:?}", bi_at, charsz_bi, self.path());
let bi_: usize = bi_at - charsz_bi;
fo_nl_b = self.file_offset_at_block_offset_index(bo_middle, bi_);
bi_nl_b = bi_;
//bi_nl_b = bi_;
bi_middle_end = bi_;
defo!(
"B1: bi_middle_end {:?} bi_nl_b {:?} fo_nl_b {:?} blockoffset_last {:?}",
"B1: bi_middle_end {:?} fo_nl_b {:?} blockoffset_last {:?}",
bi_middle_end,
bi_nl_b,
fo_nl_b,
blockoffset_last,
);
Expand Down Expand Up @@ -1214,7 +1213,7 @@ impl LineReader {
defo!("({}) A1b: self.get_linep({}) returned {:p}", fileoffset, fo_, linep_prev,);
// TODO: Issue #61 enable expression attribute when feature is stable
// #[allow(unused_assignments)]
found_nl_a = true;
//found_nl_a = true;
fo_nl_a = (*linep_prev).fileoffset_end();
debug_assert_eq!(
fo_nl_a, fo_,
Expand Down Expand Up @@ -1366,9 +1365,8 @@ impl LineReader {
}
if !found_nl_a && begof {
found_nl_a = true;
// TODO: Issue #61 enable expression attribute when feature is stable
// #[allow(unused_assignments)]
fo_nl_a = 0;
//#[allow(unused_assignments)]
//fo_nl_a = 0;
fo_nl_a1 = 0;
}
if !found_nl_a {
Expand Down Expand Up @@ -1948,7 +1946,7 @@ impl LineReader {
defo!("A1b: self.get_linep({}) returned {:p}", fo_, linep_prev,);
// TODO: Issue #61 enable expression attribute when feature is stable
// #[allow(unused_assignments)]
found_nl_a = true;
//found_nl_a = true;
fo_nl_a = (*linep_prev).fileoffset_end();
debug_assert_eq!(
fo_nl_a,
Expand Down Expand Up @@ -2075,10 +2073,10 @@ impl LineReader {
found_nl_a = true;
// TODO: Issue #61 enable expression attribute when feature is stable
// #[allow(unused_assignments)]
fo_nl_a = 0;
//fo_nl_a = 0;
// TODO: Issue #61 enable expression attribute when feature is stable
// #[allow(unused_assignments)]
fo_nl_a1 = 0;
//fo_nl_a1 = 0;
}

if !found_nl_a && !begof {
Expand Down
11 changes: 4 additions & 7 deletions src/readers/syslinereader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2290,7 +2290,6 @@ impl SyslineReader {
#[allow(unused_assignments)]
let mut try_fo_last: FileOffset = try_fo;
#[allow(unused_assignments)]
let mut fo_last: FileOffset = fileoffset;
let mut syslinep_opt: Option<SyslineP> = None;
let mut fo_a: FileOffset = fileoffset; // begin "range cursor" marker
let mut fo_b: FileOffset = _fo_end; // end "range cursor" marker
Expand Down Expand Up @@ -2326,9 +2325,8 @@ impl SyslineReader {
match SyslineReader::sysline_dt_after_or_before(&syslinep, dt_filter) {
Result_Filter_DateTime1::Pass => {
defo!(
"Pass => fo {} fo_last {} try_fo {} try_fo_last {} (fo_end {})",
"Pass => fo {} try_fo {} try_fo_last {} (fo_end {})",
fo,
fo_last,
try_fo,
try_fo_last,
_fo_end,
Expand All @@ -2340,7 +2338,7 @@ impl SyslineReader {
Result_Filter_DateTime1::OccursAtOrAfter => {
// the Sysline found by `find_sysline(try_fo)` occurs at or after filter `dt_filter`, so search backward
// i.e. move end marker `fo_b` backward
defo!("OccursAtOrAfter => fo {} fo_last {} try_fo {} try_fo_last {} fo_a {} fo_b {} (fo_end {})", fo, fo_last, try_fo, try_fo_last, fo_a, fo_b, _fo_end);
defo!("OccursAtOrAfter => fo {} try_fo {} try_fo_last {} fo_a {} fo_b {} (fo_end {})", fo, try_fo, try_fo_last, fo_a, fo_b, _fo_end);
// short-circuit a common case, passed fileoffset is past the `dt_filter`, can immediately return
// XXX: does this mean my algorithm sucks?
if try_fo == fileoffset {
Expand Down Expand Up @@ -2381,7 +2379,7 @@ impl SyslineReader {
Result_Filter_DateTime1::OccursBefore => {
// the Sysline found by `find_sysline(try_fo)` occurs before filter `dt_filter`, so search forthward
// i.e. move begin marker `fo_a` forthward
defo!("OccursBefore => fo {} fo_last {} try_fo {} try_fo_last {} fo_a {} fo_b {} (fo_end {})", fo, fo_last, try_fo, try_fo_last, fo_a, fo_b, _fo_end);
defo!("OccursBefore => fo {} try_fo {} try_fo_last {} fo_a {} fo_b {} (fo_end {})", fo, try_fo, try_fo_last, fo_a, fo_b, _fo_end);
let syslinep_foe: FileOffset = (*syslinep).fileoffset_end();
try_fo_last = try_fo;
assert_le!(try_fo_last, syslinep_foe, "Unexpected values try_fo_last {} syslinep_foe {}, last tried offset (passed to self.find_sysline({})) is beyond returned Sysline@{:p}.fileoffset_end() {}!? FPath {:?}", try_fo_last, syslinep_foe, try_fo, syslinep, syslinep_foe, self.path());
Expand All @@ -2400,8 +2398,7 @@ impl SyslineReader {
try_fo = fo_a + ((fo_b - fo_a) / 2);
} // end OccursBefore
} // end SyslineReader::sysline_dt_after_or_before()
defo!(" fo {} fo_last {} try_fo {} try_fo_last {} fo_a {} fo_b {} (fo_end {})", fo, fo_last, try_fo, try_fo_last, fo_a, fo_b, _fo_end);
fo_last = fo;
defo!(" fo {} try_fo {} try_fo_last {} fo_a {} fo_b {} (fo_end {})", fo, try_fo, try_fo_last, fo_a, fo_b, _fo_end);
syslinep_opt = Some(syslinep);
// TODO: [2021/09/26]
// I think this could do an early check and potentially skip a few loops.
Expand Down

0 comments on commit 1fdef28

Please sign in to comment.