more type casting to allow easy i32 extraction #603
clippy
121 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 121 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.73.0 (cc66ad468 2023-10-03)
- cargo 1.73.0 (9c4383fb5 2023-08-26)
- clippy 0.1.73 (cc66ad4 2023-10-03)
Annotations
Check warning on line 266 in src/structure/wavelettree.rs
github-actions / clippy
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> src/structure/wavelettree.rs:266:54
|
266 | fn push_to_fragments(num: u64, width: u8, fragments: &mut Vec<FragmentBuilder>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [FragmentBuilder]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
Check warning on line 171 in src/structure/wavelettree.rs
github-actions / clippy
casting to the same type is unnecessary (`u64` -> `u64`)
warning: casting to the same type is unnecessary (`u64` -> `u64`)
--> src/structure/wavelettree.rs:171:32
|
171 | let mut alphabet_end = 2_u64.pow(self.num_layers as u32) as u64;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `2_u64.pow(self.num_layers as u32)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 125 in src/structure/wavelettree.rs
github-actions / clippy
casting to the same type is unnecessary (`u64` -> `u64`)
warning: casting to the same type is unnecessary (`u64` -> `u64`)
--> src/structure/wavelettree.rs:125:32
|
125 | let mut alphabet_end = 2_u64.pow(self.num_layers as u32) as u64;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `2_u64.pow(self.num_layers as u32)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 101 in src/structure/wavelettree.rs
github-actions / clippy
struct `WaveletTree` has a public `len` method, but no `is_empty` method
warning: struct `WaveletTree` has a public `len` method, but no `is_empty` method
--> src/structure/wavelettree.rs:101:5
|
101 | pub fn len(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
Check warning on line 43 in src/structure/wavelettree.rs
github-actions / clippy
struct `WaveletLookup` has a public `len` method, but no `is_empty` method
warning: struct `WaveletLookup` has a public `len` method, but no `is_empty` method
--> src/structure/wavelettree.rs:43:5
|
43 | pub fn len(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
Check warning on line 43 in src/structure/util.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/structure/util.rs:43:17
|
43 | w.write_all(&bytes).await?;
| ^^^^^^ help: change this to: `bytes`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 472 in src/structure/tfc/typed.rs
github-actions / clippy
casting to the same type is unnecessary (`u64` -> `u64`)
warning: casting to the same type is unnecessary (`u64` -> `u64`)
--> src/structure/tfc/typed.rs:472:23
|
472 | .push(block_offset_builder.count() as u64 - 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `block_offset_builder.count()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 464 in src/structure/tfc/typed.rs
github-actions / clippy
called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
warning: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> src/structure/tfc/typed.rs:462:13
|
462 | / self.sized_dict_buf_builder
463 | | .as_mut()
464 | | .map(|b| b.record_size = value.datatype.record_size());
| |______________________________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
= note: `#[warn(clippy::option_map_unit_fn)]` on by default
help: try
|
462 ~ if let Some(b) = self.sized_dict_buf_builder
463 + .as_mut() { ... }
|
Check warning on line 390 in src/structure/tfc/typed.rs
github-actions / clippy
method `into_iter` can be confused for the standard trait method `std::iter::IntoIterator::into_iter`
warning: method `into_iter` can be confused for the standard trait method `std::iter::IntoIterator::into_iter`
--> src/structure/tfc/typed.rs:388:5
|
388 | / pub fn into_iter(self) -> impl Iterator<Item = SizedDictEntry> + Clone {
389 | | self.0.into_iter()
390 | | }
| |_____^
|
= help: consider implementing the trait `std::iter::IntoIterator` or choosing a less ambiguous method name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait
Check warning on line 384 in src/structure/tfc/typed.rs
github-actions / clippy
the following explicit lifetimes could be elided: 'a
warning: the following explicit lifetimes could be elided: 'a
--> src/structure/tfc/typed.rs:384:17
|
384 | pub fn iter<'a>(&'a self) -> impl Iterator<Item = SizedDictEntry> + 'a + Clone {
| ^^ ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
384 - pub fn iter<'a>(&'a self) -> impl Iterator<Item = SizedDictEntry> + 'a + Clone {
384 + pub fn iter(&self) -> impl Iterator<Item = SizedDictEntry> + '_ + Clone {
|
Check warning on line 357 in src/structure/tfc/typed.rs
github-actions / clippy
method `into_iter` can be confused for the standard trait method `std::iter::IntoIterator::into_iter`
warning: method `into_iter` can be confused for the standard trait method `std::iter::IntoIterator::into_iter`
--> src/structure/tfc/typed.rs:355:5
|
355 | / pub fn into_iter(self) -> impl Iterator<Item = SizedDictEntry> + Clone {
356 | | self.dict.into_iter()
357 | | }
| |_____^
|
= help: consider implementing the trait `std::iter::IntoIterator` or choosing a less ambiguous method name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait
Check warning on line 351 in src/structure/tfc/typed.rs
github-actions / clippy
the following explicit lifetimes could be elided: 'a
warning: the following explicit lifetimes could be elided: 'a
--> src/structure/tfc/typed.rs:351:17
|
351 | pub fn iter<'a>(&'a self) -> impl Iterator<Item = SizedDictEntry> + 'a + Clone {
| ^^ ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
351 - pub fn iter<'a>(&'a self) -> impl Iterator<Item = SizedDictEntry> + 'a + Clone {
351 + pub fn iter(&self) -> impl Iterator<Item = SizedDictEntry> + '_ + Clone {
|
Check warning on line 295 in src/structure/tfc/typed.rs
github-actions / clippy
method `into_iter` can be confused for the standard trait method `std::iter::IntoIterator::into_iter`
warning: method `into_iter` can be confused for the standard trait method `std::iter::IntoIterator::into_iter`
--> src/structure/tfc/typed.rs:289:5
|
289 | / pub fn into_iter(self) -> impl Iterator<Item = TypedDictEntry> + Clone {
290 | | self.into_block_iter().flat_map(|(datatype, segment)| {
291 | | segment
292 | | .into_iter()
293 | | .map(move |entry| TypedDictEntry::new(datatype, entry))
294 | | })
295 | | }
| |_____^
|
= help: consider implementing the trait `std::iter::IntoIterator` or choosing a less ambiguous method name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait
Check warning on line 281 in src/structure/tfc/typed.rs
github-actions / clippy
the following explicit lifetimes could be elided: 'a
warning: the following explicit lifetimes could be elided: 'a
--> src/structure/tfc/typed.rs:281:17
|
281 | pub fn iter<'a>(&'a self) -> impl Iterator<Item = TypedDictEntry> + 'a + Clone {
| ^^ ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
281 - pub fn iter<'a>(&'a self) -> impl Iterator<Item = TypedDictEntry> + 'a + Clone {
281 + pub fn iter(&self) -> impl Iterator<Item = TypedDictEntry> + '_ + Clone {
|
Check warning on line 263 in src/structure/tfc/typed.rs
github-actions / clippy
the following explicit lifetimes could be elided: 'a
warning: the following explicit lifetimes could be elided: 'a
--> src/structure/tfc/typed.rs:263:23
|
263 | pub fn block_iter<'a>(
| ^^
264 | &'a self,
| ^^
265 | ) -> impl Iterator<Item = (Datatype, SizedDictBlock)> + 'a + Clone {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
263 ~ pub fn block_iter(
264 ~ &self,
265 ~ ) -> impl Iterator<Item = (Datatype, SizedDictBlock)> + '_ + Clone {
|
Check warning on line 251 in src/structure/tfc/typed.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/structure/tfc/typed.rs:251:33
|
251 | dict: Cow::Borrowed(&self),
| ^^^^^ help: change this to: `self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 249 in src/structure/tfc/typed.rs
github-actions / clippy
the following explicit lifetimes could be elided: 'a
warning: the following explicit lifetimes could be elided: 'a
--> src/structure/tfc/typed.rs:249:25
|
249 | pub fn segment_iter<'a>(&'a self) -> DictSegmentIterator<'a> {
| ^^ ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
249 - pub fn segment_iter<'a>(&'a self) -> DictSegmentIterator<'a> {
249 + pub fn segment_iter(&self) -> DictSegmentIterator<'_> {
|
Check warning on line 201 in src/structure/tfc/typed.rs
github-actions / clippy
manual implementation of `Option::map`
warning: manual implementation of `Option::map`
--> src/structure/tfc/typed.rs:197:9
|
197 | / if let Some(i) = self.types_present.index_of(dt as u64) {
198 | | Some(self.inner_type_segment(i))
199 | | } else {
200 | | None
201 | | }
| |_________^ help: try: `self.types_present.index_of(dt as u64).map(|i| self.inner_type_segment(i))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
= note: `#[warn(clippy::manual_map)]` on by default
Check warning on line 192 in src/structure/tfc/typed.rs
github-actions / clippy
casting to the same type is unnecessary (`u64` -> `u64`)
warning: casting to the same type is unnecessary (`u64` -> `u64`)
--> src/structure/tfc/typed.rs:192:13
|
192 | id_offset as u64,
| ^^^^^^^^^^^^^^^^ help: try: `id_offset`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 160 in src/structure/tfc/typed.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> src/structure/tfc/typed.rs:160:53
|
160 | block_offset = self.block_offsets.entry(type_offset as usize) as usize;
| ^^^^^^^^^^^^^^^^^^^^ help: try: `type_offset`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 33 in src/structure/tfc/stream.rs
github-actions / clippy
very complex type used. Consider factoring parts into `type` definitions
warning: very complex type used. Consider factoring parts into `type` definitions
--> src/structure/tfc/stream.rs:23:9
|
23 | / Pin<
24 | | Box<
25 | | dyn Future<
26 | | Output = Result<
... |
32 | | >,
33 | | >,
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
= note: `#[warn(clippy::type_complexity)]` on by default
Check warning on line 243 in src/structure/tfc/dict.rs
github-actions / clippy
method `into_iter` can be confused for the standard trait method `std::iter::IntoIterator::into_iter`
warning: method `into_iter` can be confused for the standard trait method `std::iter::IntoIterator::into_iter`
--> src/structure/tfc/dict.rs:241:5
|
241 | / pub fn into_iter(self) -> impl Iterator<Item = SizedDictEntry> + Clone {
242 | | self.into_block_iter().flat_map(|b| b.into_iter())
243 | | }
| |_____^
|
= help: consider implementing the trait `std::iter::IntoIterator` or choosing a less ambiguous method name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait
Check warning on line 237 in src/structure/tfc/dict.rs
github-actions / clippy
the following explicit lifetimes could be elided: 'a
warning: the following explicit lifetimes could be elided: 'a
--> src/structure/tfc/dict.rs:237:17
|
237 | pub fn iter<'a>(&'a self) -> impl Iterator<Item = SizedDictEntry> + 'a + Clone {
| ^^ ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
237 - pub fn iter<'a>(&'a self) -> impl Iterator<Item = SizedDictEntry> + 'a + Clone {
237 + pub fn iter(&self) -> impl Iterator<Item = SizedDictEntry> + '_ + Clone {
|
Check warning on line 223 in src/structure/tfc/dict.rs
github-actions / clippy
the following explicit lifetimes could be elided: 'a
warning: the following explicit lifetimes could be elided: 'a
--> src/structure/tfc/dict.rs:223:23
|
223 | pub fn block_iter<'a>(&'a self) -> SizedDictBlockIterator<'a> {
| ^^ ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
223 - pub fn block_iter<'a>(&'a self) -> SizedDictBlockIterator<'a> {
223 + pub fn block_iter(&self) -> SizedDictBlockIterator<'_> {
|
Check warning on line 220 in src/structure/tfc/dict.rs
github-actions / clippy
returning the result of a `let` binding from a block
warning: returning the result of a `let` binding from a block
--> src/structure/tfc/dict.rs:220:9
|
207 | let result = block_id.offset(offset).default(offset - 1);
| --------------------------------------------------------- unnecessary `let` binding
...
220 | result
| ^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
help: return the expression directly
|
207 ~
208 | /*
...
219 |
220 ~ block_id.offset(offset).default(offset - 1)
|