fix example #109
clippy
57 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 57 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.71.0 (8ede3aae2 2023-07-12)
- cargo 1.71.0 (cfd3bbd8f 2023-06-08)
- clippy 0.1.71 (8ede3aa 2023-07-12)
Annotations
github-actions / clippy
unused `std::result::Result` that must be used
warning: unused `std::result::Result` that must be used
--> pdf/src/font.rs:669:17
|
669 | writeln!(buf, "]");
| ^^^^^^^^^^^^^^^^^^
|
= note: this `Result` may be an `Err` variant, which should be handled
= note: this warning originates in the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info)
github-actions / clippy
unused `std::result::Result` that must be used
warning: unused `std::result::Result` that must be used
--> pdf/src/font.rs:652:21
|
652 | writeln!(buf);
| ^^^^^^^^^^^^^
|
= note: this `Result` may be an `Err` variant, which should be handled
= note: this warning originates in the macro `$crate::write` which comes from the expansion of the macro `writeln` (in Nightly builds, run with -Z macro-backtrace for more info)
Check warning on line 95 in pdf/src/backend.rs
github-actions / clippy
unused `std::result::Result` that must be used
warning: unused `std::result::Result` that must be used
--> pdf/src/backend.rs:95:17
|
95 | refs.add_entries_from(section);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this `Result` may be an `Err` variant, which should be handled
= note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
|
95 | let _ = refs.add_entries_from(section);
| +++++++
Check warning on line 188 in pdf/src/crypt.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> pdf/src/crypt.rs:188:26
|
188 | hash.consume(&PADDING);
| ^^^^^^^^ help: change this to: `PADDING`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 421 in pdf/src/enc.rs
github-actions / clippy
manual implementation of an assign operation
warning: manual implementation of an assign operation
--> pdf/src/enc.rs:421:13
|
421 | c = c + 2; // move cursor to next run
| ^^^^^^^^^ help: replace it with: `c += 2`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern
= note: `#[warn(clippy::assign_op_pattern)]` on by default
Check warning on line 127 in pdf/src/build.rs
github-actions / clippy
the following explicit lifetimes could be elided: 'a
warning: the following explicit lifetimes could be elided: 'a
--> pdf/src/build.rs:127:5
|
127 | pub fn new<'a>(fileoptions: FileOptions<'a, SC, OC, L>) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
= note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
|
127 - pub fn new<'a>(fileoptions: FileOptions<'a, SC, OC, L>) -> Self {
127 + pub fn new(fileoptions: FileOptions<'_, SC, OC, L>) -> Self {
|
Check warning on line 556 in pdf/src/font.rs
github-actions / clippy
redundant pattern matching, consider using `is_err()`
warning: redundant pattern matching, consider using `is_err()`
--> pdf/src/font.rs:556:24
|
556 | if let Err(_) = a {
| -------^^^^^^---- help: try this: `if a.is_err()`
|
= note: this will change drop order of the result, as well as all temporaries
= note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
Check warning on line 538 in pdf/src/font.rs
github-actions / clippy
redundant pattern matching, consider using `is_err()`
warning: redundant pattern matching, consider using `is_err()`
--> pdf/src/font.rs:538:24
|
538 | if let Err(_) = a {
| -------^^^^^^---- help: try this: `if a.is_err()`
|
= note: this will change drop order of the result, as well as all temporaries
= note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
= note: `#[warn(clippy::redundant_pattern_matching)]` on by default
Check warning on line 499 in pdf/src/font.rs
github-actions / clippy
struct `ToUnicodeMap` has a public `len` method, but no `is_empty` method
warning: struct `ToUnicodeMap` has a public `len` method, but no `is_empty` method
--> pdf/src/font.rs:499:5
|
499 | pub fn len(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
= note: `#[warn(clippy::len_without_is_empty)]` on by default
Check warning on line 483 in pdf/src/font.rs
github-actions / clippy
you should consider adding a `Default` implementation for `ToUnicodeMap`
warning: you should consider adding a `Default` implementation for `ToUnicodeMap`
--> pdf/src/font.rs:479:5
|
479 | / pub fn new() -> Self {
480 | | ToUnicodeMap {
481 | | inner: HashMap::new()
482 | | }
483 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
= note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
|
478 + impl Default for ToUnicodeMap {
479 + fn default() -> Self {
480 + Self::new()
481 + }
482 + }
|
Check warning on line 300 in pdf/src/font.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> pdf/src/font.rs:300:38
|
300 | ... for c in (c1 as usize) ..= (c2 as usize) {
| ^^^^^^^^^^^^^ help: try: `c1`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 281 in pdf/src/font.rs
github-actions / clippy
dereferencing a tuple pattern where every element takes a reference
warning: dereferencing a tuple pattern where every element takes a reference
--> pdf/src/font.rs:281:30
|
281 | Some(&Primitive::Array(ref array)) => {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
help: try removing the `&` and `ref` parts
|
281 - Some(&Primitive::Array(ref array)) => {
281 + Some(Primitive::Array(array)) => {
|
Check warning on line 195 in pdf/src/parser/mod.rs
github-actions / clippy
deref which would be done by auto-deref
warning: deref which would be done by auto-deref
--> pdf/src/parser/mod.rs:195:31
|
195 | let mut rest: &[u8] = &*first_lexeme.reslice(1..);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&first_lexeme.reslice(1..)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
Check warning on line 184 in pdf/src/parser/mod.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> pdf/src/parser/mod.rs:184:27
|
184 | lexer.set_pos(pos_bk as usize); // (roll back the lexer first)
| ^^^^^^^^^^^^^^^ help: try: `pos_bk`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 178 in pdf/src/parser/mod.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> pdf/src/parser/mod.rs:178:31
|
178 | lexer.set_pos(pos_bk as usize); // (roll back the lexer first)
| ^^^^^^^^^^^^^^^ help: try: `pos_bk`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 468 in pdf/src/parser/lexer/mod.rs
github-actions / clippy
manual check for common ascii range
warning: manual check for common ascii range
--> pdf/src/parser/lexer/mod.rs:468:23
|
468 | b.iter().all(|&b| matches!(b, b'0'..=b'9'))
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b.is_ascii_digit()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_ascii_check
Check warning on line 429 in pdf/src/parser/lexer/mod.rs
github-actions / clippy
manual check for common ascii range
warning: manual check for common ascii range
--> pdf/src/parser/lexer/mod.rs:429:56
|
429 | if let Some(len) = slice.iter().position(|&b| !matches!(b, b'0'..=b'9')) {
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b.is_ascii_digit()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_ascii_check
= note: `#[warn(clippy::manual_is_ascii_check)]` on by default
Check warning on line 34 in pdf/src/content.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
--> pdf/src/content.rs:34:15
|
34 | ops.parse(&data, resolve)?;
| ^^^^^ help: change this to: `data`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 668 in pdf/src/primitive.rs
github-actions / clippy
deref on an immutable reference
warning: deref on an immutable reference
--> pdf/src/primitive.rs:668:56
|
668 | Primitive::Name(ref s) => Ok(Cow::Borrowed(&*s)),
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref
= note: `#[warn(clippy::borrow_deref_ref)]` on by default
help: if you would like to reborrow, try removing `&*`
|
668 | Primitive::Name(ref s) => Ok(Cow::Borrowed(s)),
| ~
help: if you would like to deref, try using `&**`
|
668 | Primitive::Name(ref s) => Ok(Cow::Borrowed(&**s)),
| ~~~~
Check warning on line 637 in pdf/src/primitive.rs
github-actions / clippy
dereferencing a tuple pattern where every element takes a reference
warning: dereferencing a tuple pattern where every element takes a reference
--> pdf/src/primitive.rs:637:13
|
637 | &Primitive::Name(ref s) => Ok(Name(s.clone())),
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
= note: `#[warn(clippy::needless_borrowed_reference)]` on by default
help: try removing the `&` and `ref` parts
|
637 - &Primitive::Name(ref s) => Ok(Name(s.clone())),
637 + Primitive::Name(s) => Ok(Name(s.clone())),
|
Check warning on line 268 in pdf/src/primitive.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
--> pdf/src/primitive.rs:268:31
|
268 | out.write_all(&data)?;
| ^^^^^ help: change this to: `data`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `#[warn(clippy::needless_borrow)]` on by default
Check warning on line 138 in pdf/src/xref.rs
github-actions / clippy
casting to the same type is unnecessary (`u64` -> `u64`)
warning: casting to the same type is unnecessary (`u64` -> `u64`)
--> pdf/src/xref.rs:138:58
|
138 | XRef::Stream { stream_id, index } => (2, stream_id as u64, index as u64),
| ^^^^^^^^^^^^^^^^ help: try: `stream_id`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 137 in pdf/src/xref.rs
github-actions / clippy
casting to the same type is unnecessary (`u64` -> `u64`)
warning: casting to the same type is unnecessary (`u64` -> `u64`)
--> pdf/src/xref.rs:137:62
|
137 | XRef::Raw { pos, gen_nr } => (1, pos as u64, gen_nr as u64),
| ^^^^^^^^^^^^^ help: try: `gen_nr`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 136 in pdf/src/xref.rs
github-actions / clippy
casting to the same type is unnecessary (`u64` -> `u64`)
warning: casting to the same type is unnecessary (`u64` -> `u64`)
--> pdf/src/xref.rs:136:72
|
136 | XRef::Free { next_obj_nr, gen_nr } => (0, next_obj_nr, gen_nr as u64),
| ^^^^^^^^^^^^^ help: try: `gen_nr`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 100 in pdf/src/xref.rs
github-actions / clippy
casting to the same type is unnecessary (`u64` -> `u64`)
warning: casting to the same type is unnecessary (`u64` -> `u64`)
--> pdf/src/xref.rs:100:55
|
100 | XRef::Stream { stream_id, index } => (stream_id as u64, index as u64),
| ^^^^^^^^^^^^^^^^ help: try: `stream_id`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast