Moving toward a paging-based recordlog#70
clippy
38 warnings
Details
Results
| Message level | Amount |
|---|---|
| Internal compiler error | 0 |
| Error | 0 |
| Warning | 38 |
| Note | 0 |
| Help | 0 |
Versions
- rustc 1.87.0 (17067e9ac 2025-05-09)
- cargo 1.87.0 (99624be96 2025-05-06)
- clippy 0.1.87 (17067e9ac6 2025-05-09)
Annotations
Check warning on line 69 in src/mockfile.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> src/mockfile.rs:69:56
|
69 | io::SeekFrom::End(offset) => self.cursor = self.buf.len() as usize + offset as usize,
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.buf.len()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 143 in src/recordlog/tests.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/recordlog/tests.rs:143:9
|
143 | let mut session = reader.start_session();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding and replace variable usages with `()`
|
143 ~ reader.start_session();
144 | for record in &records[0..72] {
145 | // bug at i=72
146 | assert_eq!(
147 ~ reader.read_record::<&str>(&mut ()).unwrap(),
148 | Some(record.as_str())
...
151 | assert!(matches!(
152 ~ reader.read_record::<&str>(&mut ()),
|
Check warning on line 130 in src/recordlog/tests.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/recordlog/tests.rs:130:9
|
130 | let mut session = reader.start_session();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding and replace variable usages with `()`
|
130 ~ reader.start_session();
131 | for record in &records {
132 | assert_eq!(
133 ~ reader.read_record::<&str>(&mut ()).unwrap(),
134 | Some(record.as_str())
135 | );
136 | }
137 ~ assert_eq!(reader.read_record::<&str>(&mut ()).unwrap(), None);
|
Check warning on line 122 in src/recordlog/tests.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/recordlog/tests.rs:122:5
|
122 | let mut session = writer.start_session().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding and replace variable usages with `()`
|
122 ~ writer.start_session().unwrap();
123 | for record in &records {
124 ~ writer.write_record(record.as_str(), &mut ()).unwrap();
|
Check warning on line 106 in src/recordlog/tests.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/recordlog/tests.rs:106:5
|
106 | let mut session = reader.start_session();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding and replace variable usages with `()`
|
106 ~ reader.start_session();
107 | assert_eq!(
108 ~ reader.read_record::<&str>(&mut ()).unwrap(),
109 | Some(long_record.as_str())
110 | );
111 | assert_eq!(
112 ~ reader.read_record::<&str>(&mut ()).unwrap(),
113 | Some(short_record)
114 | );
115 ~ assert_eq!(reader.read_record::<&str>(&mut ()).unwrap(), None);
|
Check warning on line 100 in src/recordlog/tests.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/recordlog/tests.rs:100:5
|
100 | let mut session = writer.start_session().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding and replace variable usages with `()`
|
100 ~ writer.start_session().unwrap();
101 ~ writer.write_record(&long_record[..], &mut ()).unwrap();
102 ~ writer.write_record(short_record, &mut ()).unwrap();
|
Check warning on line 81 in src/recordlog/tests.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/recordlog/tests.rs:81:5
|
81 | let mut session = reader.start_session();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding and replace variable usages with `()`
|
81 ~ reader.start_session();
82 | assert_eq!(
83 ~ reader.read_record::<&str>(&mut ()).unwrap(),
84 | Some(long_record.as_str())
85 | );
86 | assert_eq!(
87 ~ reader.read_record::<&str>(&mut ()).unwrap(),
88 | Some(short_record)
89 | );
90 ~ assert_eq!(reader.read_record::<&str>(&mut ()).unwrap(), None);
|
Check warning on line 73 in src/recordlog/tests.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/recordlog/tests.rs:73:5
|
73 | let mut session = writer.start_session().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding and replace variable usages with `()`
|
73 ~ writer.start_session().unwrap();
74 | writer
75 ~ .write_record(long_record.as_str(), &mut ())
76 | .unwrap();
77 ~ writer.write_record(short_record, &mut ()).unwrap();
|
Check warning on line 60 in src/recordlog/tests.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/recordlog/tests.rs:60:5
|
60 | let mut session = reader.start_session();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding and replace variable usages with `()`
|
60 ~ reader.start_session();
61 ~ let record_payload: &str = reader.read_record(&mut ()).unwrap().unwrap();
62 | assert_eq!(record_payload, &long_entry);
63 ~ assert_eq!(reader.read_record::<&str>(&mut ()).unwrap(), None);
|
Check warning on line 53 in src/recordlog/tests.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/recordlog/tests.rs:53:5
|
53 | let mut session = writer.start_session().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding and replace variable usages with `()`
|
53 ~ writer.start_session().unwrap();
54 | writer
55 ~ .write_record(long_entry.as_str(), &mut ())
|
Check warning on line 37 in src/recordlog/tests.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/recordlog/tests.rs:37:5
|
37 | let mut session = reader.start_session();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding and replace variable usages with `()`
|
37 ~ reader.start_session();
38 | assert!(matches!(
39 ~ reader.read_record::<&str>(&mut ()),
40 | Ok(Some("hello"))
41 | ));
42 ~ assert!(matches!(reader.read_record::<&str>(&mut ()), Ok(None)));
|
Check warning on line 31 in src/recordlog/tests.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/recordlog/tests.rs:31:5
|
31 | let mut session = writer.start_session().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding and replace variable usages with `()`
|
31 ~ writer.start_session().unwrap();
32 | let record = "hello";
33 ~ writer.write_record(record, &mut ()).unwrap();
|
Check warning on line 23 in src/recordlog/tests.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/recordlog/tests.rs:23:5
|
23 | let mut session = reader.start_session();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding and replace variable usages with `()`
|
23 ~ reader.start_session();
24 ~ assert_eq!(reader.read_record::<&str>(&mut ()).unwrap(), Some(""));
25 ~ assert_eq!(reader.read_record::<&str>(&mut ()).unwrap(), None);
|
Check warning on line 18 in src/recordlog/tests.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/recordlog/tests.rs:18:5
|
18 | let mut session = writer.start_session().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding and replace variable usages with `()`
|
18 ~ writer.start_session().unwrap();
19 ~ writer.write_record("", &mut ()).unwrap();
|
Check warning on line 11 in src/recordlog/tests.rs
github-actions / clippy
this let-binding has unit value
warning: this let-binding has unit value
--> src/recordlog/tests.rs:11:5
|
11 | let mut session = reader.start_session();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
help: omit the `let` binding and replace variable usages with `()`
|
11 ~ reader.start_session();
12 ~ assert_eq!(reader.read_record::<&str>(&mut ()).unwrap(), None);
|
Check warning on line 61 in src/recordlog/writer.rs
github-actions / clippy
current MSRV (Minimum Supported Rust Version) is `1.68.0` but this item is stable since `1.73.0`
warning: current MSRV (Minimum Supported Rust Version) is `1.68.0` but this item is stable since `1.73.0`
--> src/recordlog/writer.rs:61:33
|
61 | * payload.len().div_ceil(BLOCK_NUM_BYTES - HEADER_LEN) as u64;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
Check warning on line 112 in src/page_directory/mod.rs
github-actions / clippy
casting to the same type is unnecessary (`u64` -> `u64`)
warning: casting to the same type is unnecessary (`u64` -> `u64`)
--> src/page_directory/mod.rs:112:72
|
112 | let page_list_writer: PageListWriter = self.reader.into_writer(offset as u64)?;
| ^^^^^^^^^^^^^ help: try: `offset`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 52 in src/page_directory/mod.rs
github-actions / clippy
file opened with `create`, but `truncate` behavior not defined
warning: file opened with `create`, but `truncate` behavior not defined
--> src/page_directory/mod.rs:52:18
|
52 | .create(true)
| ^^^^^^^^^^^^- help: add: `.truncate(true)`
|
= help: if you intend to overwrite an existing file entirely, call `.truncate(true)`
= help: if you instead know that you may want to keep some parts of the old file, call `.truncate(false)`
= help: alternatively, use `.append(true)` to append to the file instead of overwriting it
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_open_options
= note: `#[warn(clippy::suspicious_open_options)]` on by default
Check warning on line 43 in src/page_directory/mod.rs
github-actions / clippy
current MSRV (Minimum Supported Rust Version) is `1.68.0` but this item is stable since `1.77.0`
warning: current MSRV (Minimum Supported Rust Version) is `1.68.0` but this item is stable since `1.77.0`
--> src/page_directory/mod.rs:43:11
|
43 | match std::fs::File::create_new(path) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
Check warning on line 108 in src/page_directory/writer.rs
github-actions / clippy
current MSRV (Minimum Supported Rust Version) is `1.68.0` but this item is stable since `1.73.0`
warning: current MSRV (Minimum Supported Rust Version) is `1.68.0` but this item is stable since `1.73.0`
--> src/page_directory/writer.rs:108:21
|
108 | self.cursor.div_ceil(PAGE_SIZE as u64) as u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
Check warning on line 42 in src/page_directory/writer.rs
github-actions / clippy
length comparison to zero
warning: length comparison to zero
--> src/page_directory/writer.rs:42:12
|
42 | if buf.len() == 0 {
| ^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `buf.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
= note: `#[warn(clippy::len_zero)]` on by default
Check warning on line 50 in src/page_directory/reader.rs
github-actions / clippy
casting to the same type is unnecessary (`u64` -> `u64`)
warning: casting to the same type is unnecessary (`u64` -> `u64`)
--> src/page_directory/reader.rs:50:40
|
50 | self.file.seek(SeekFrom::Start(page_start_offset as u64))?;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `page_start_offset`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
= note: `#[warn(clippy::unnecessary_cast)]` on by default
Check warning on line 208 in src/page_directory/page_list.rs
github-actions / clippy
current MSRV (Minimum Supported Rust Version) is `1.68.0` but this item is stable since `1.73.0`
warning: current MSRV (Minimum Supported Rust Version) is `1.68.0` but this item is stable since `1.73.0`
--> src/page_directory/page_list.rs:208:38
|
208 | let written_page_id = cursor.div_ceil(PAGE_SIZE as u64) as usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
Check warning on line 92 in src/page_directory/page_list.rs
github-actions / clippy
current MSRV (Minimum Supported Rust Version) is `1.68.0` but this item is stable since `1.73.0`
warning: current MSRV (Minimum Supported Rust Version) is `1.68.0` but this item is stable since `1.73.0`
--> src/page_directory/page_list.rs:92:20
|
92 | let k = offset.div_ceil(mult);
| ^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incompatible_msrv
Check warning on line 62 in src/page_directory/page_list.rs
github-actions / clippy
useless conversion to the same type: `[u8; 8]`
warning: useless conversion to the same type: `[u8; 8]`
--> src/page_directory/page_list.rs:62:36
|
62 | let epoch = u64::from_le_bytes(epoch_bytes.try_into().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider removing `.try_into()`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `#[warn(clippy::useless_conversion)]` on by default