clean up code #113
Annotations
1 error and 81 warnings
incorrect implementation of `clone` on a `Copy` type:
pdf/src/object/mod.rs#L152
error: incorrect implementation of `clone` on a `Copy` type
--> pdf/src/object/mod.rs:152:31
|
152 | fn clone(&self) -> Ref<T> {
| _______________________________^
153 | | Ref {
154 | | inner: self.inner,
155 | | _marker: PhantomData
156 | | }
157 | | }
| |_____^ help: change this to: `{ *self }`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#incorrect_clone_impl_on_copy_type
= note: `#[deny(clippy::incorrect_clone_impl_on_copy_type)]` on by default
|
unused `std::result::Result` that must be used:
/rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/macros/mod.rs#L557
warning: unused `std::result::Result` that must be used
--> pdf/src/font.rs:680:17
|
680 | 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)
|
unused `std::result::Result` that must be used:
/rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/macros/mod.rs#L519
warning: unused `std::result::Result` that must be used
--> pdf/src/font.rs:663:21
|
663 | 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)
|
unused `std::result::Result` that must be used:
pdf/src/backend.rs#L95
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);
| +++++++
|
this OR pattern can be rewritten using a range:
pdf/src/crypt.rs#L301
warning: this OR pattern can be rewritten using a range
--> pdf/src/crypt.rs:301:13
|
301 | 4 | 5 | 6 => {
| ^^^^^^^^^ help: try: `4..=6`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_patterns
= note: `#[warn(clippy::manual_range_patterns)]` on by default
|
the borrowed expression implements the required traits:
pdf/src/crypt.rs#L188
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
|
manual implementation of an assign operation:
pdf/src/enc.rs#L421
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
|
the following explicit lifetimes could be elided: 'a:
pdf/src/build.rs#L127
warning: the following explicit lifetimes could be elided: 'a
--> pdf/src/build.rs:127:16
|
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 {
|
|
redundant pattern matching, consider using `is_err()`:
pdf/src/font.rs#L567
warning: redundant pattern matching, consider using `is_err()`
--> pdf/src/font.rs:567:24
|
567 | 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
|
redundant pattern matching, consider using `is_err()`:
pdf/src/font.rs#L549
warning: redundant pattern matching, consider using `is_err()`
--> pdf/src/font.rs:549:24
|
549 | 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
|
struct `ToUnicodeMap` has a public `len` method, but no `is_empty` method:
pdf/src/font.rs#L510
warning: struct `ToUnicodeMap` has a public `len` method, but no `is_empty` method
--> pdf/src/font.rs:510:5
|
510 | 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
|
you should consider adding a `Default` implementation for `ToUnicodeMap`:
pdf/src/font.rs#L490
warning: you should consider adding a `Default` implementation for `ToUnicodeMap`
--> pdf/src/font.rs:490:5
|
490 | / pub fn new() -> Self {
491 | | ToUnicodeMap {
492 | | inner: HashMap::new()
493 | | }
494 | | }
| |_____^
|
= 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
|
489 + impl Default for ToUnicodeMap {
490 + fn default() -> Self {
491 + Self::new()
492 + }
493 + }
|
|
casting to the same type is unnecessary (`usize` -> `usize`):
pdf/src/font.rs#L311
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> pdf/src/font.rs:311:38
|
311 | ... 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
|
dereferencing a tuple pattern where every element takes a reference:
pdf/src/font.rs#L292
warning: dereferencing a tuple pattern where every element takes a reference
--> pdf/src/font.rs:292:30
|
292 | 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
|
292 - Some(&Primitive::Array(ref array)) => {
292 + Some(Primitive::Array(array)) => {
|
|
deref which would be done by auto-deref:
pdf/src/parser/mod.rs#L195
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
|
casting to the same type is unnecessary (`usize` -> `usize`):
pdf/src/parser/mod.rs#L184
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
|
casting to the same type is unnecessary (`usize` -> `usize`):
pdf/src/parser/mod.rs#L178
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
|
manual check for common ascii range:
pdf/src/parser/lexer/mod.rs#L468
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
|
manual check for common ascii range:
pdf/src/parser/lexer/mod.rs#L429
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
|
this expression creates a reference which is immediately dereferenced by the compiler:
pdf/src/content.rs#L34
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
|
deref on an immutable reference:
pdf/src/primitive.rs#L681
warning: deref on an immutable reference
--> pdf/src/primitive.rs:681:56
|
681 | 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
help: if you would like to reborrow, try removing `&*`
|
681 | Primitive::Name(ref s) => Ok(Cow::Borrowed(s)),
| ~
help: if you would like to deref, try using `&**`
|
681 | Primitive::Name(ref s) => Ok(Cow::Borrowed(&**s)),
| ~~~~
|
dereferencing a tuple pattern where every element takes a reference:
pdf/src/primitive.rs#L650
warning: dereferencing a tuple pattern where every element takes a reference
--> pdf/src/primitive.rs:650:13
|
650 | &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
|
650 - &Primitive::Name(ref s) => Ok(Name(s.clone())),
650 + Primitive::Name(s) => Ok(Name(s.clone())),
|
|
manual `Range::contains` implementation:
pdf/src/primitive.rs#L492
warning: manual `Range::contains` implementation
--> pdf/src/primitive.rs:492:38
|
492 | Primitive::Integer(n) if n >= 0 && n < 256 => Ok(n as u8),
| ^^^^^^^^^^^^^^^^^ help: use: `(0..256).contains(&n)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
= note: `#[warn(clippy::manual_range_contains)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
pdf/src/primitive.rs#L268
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
|
casting to the same type is unnecessary (`u64` -> `u64`):
pdf/src/xref.rs#L138
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
|
casting to the same type is unnecessary (`u64` -> `u64`):
pdf/src/xref.rs#L137
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
|
casting to the same type is unnecessary (`u64` -> `u64`):
pdf/src/xref.rs#L136
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
|
casting to the same type is unnecessary (`u64` -> `u64`):
pdf/src/xref.rs#L100
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
|
casting to the same type is unnecessary (`u64` -> `u64`):
pdf/src/xref.rs#L99
warning: casting to the same type is unnecessary (`u64` -> `u64`)
--> pdf/src/xref.rs:99:69
|
99 | XRef::Free { next_obj_nr, gen_nr } => (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
|
casting to the same type is unnecessary (`u64` -> `u64`):
pdf/src/xref.rs#L98
warning: casting to the same type is unnecessary (`u64` -> `u64`)
--> pdf/src/xref.rs:98:59
|
98 | XRef::Raw { pos, gen_nr } => (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
= note: `#[warn(clippy::unnecessary_cast)]` on by default
|
deref which would be done by auto-deref:
pdf/src/object/mod.rs#L327
warning: deref which would be done by auto-deref
--> pdf/src/object/mod.rs:327:42
|
327 | MaybeRef::Indirect(ref r) => &**r
| ^^^^ help: try this: `r`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
|
deref which would be done by auto-deref:
pdf/src/object/mod.rs#L254
warning: deref which would be done by auto-deref
--> pdf/src/object/mod.rs:254:9
|
254 | &*self.data
| ^^^^^^^^^^^ help: try this: `&self.data`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
|
use of `default` to create a unit struct:
pdf/src/object/mod.rs#L171
warning: use of `default` to create a unit struct
--> pdf/src/object/mod.rs:171:36
|
171 | _marker: PhantomData::default(),
| ^^^^^^^^^^^ help: remove this call to `default`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs
|
use of `default` to create a unit struct:
pdf/src/object/mod.rs#L165
warning: use of `default` to create a unit struct
--> pdf/src/object/mod.rs:165:36
|
165 | _marker: PhantomData::default(),
| ^^^^^^^^^^^ help: remove this call to `default`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs
= note: `#[warn(clippy::default_constructed_unit_structs)]` on by default
|
deref on an immutable reference:
pdf/src/object/types.rs#L621
warning: deref on an immutable reference
--> pdf/src/object/types.rs:621:16
|
621 | if &*decode == &[1.0, 0.0] {
| ^^^^^^^^
|
= 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 `&*`
|
621 | if decode == &[1.0, 0.0] {
| ~~~~~~
help: if you would like to deref, try using `&**`
|
621 | if &**decode == &[1.0, 0.0] {
| ~~~~~~~~~
|
needlessly taken reference of both operands:
pdf/src/object/types.rs#L621
warning: needlessly taken reference of both operands
--> pdf/src/object/types.rs:621:16
|
621 | if &*decode == &[1.0, 0.0] {
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref
= note: `#[warn(clippy::op_ref)]` on by default
help: use the values directly
|
621 | if *decode == [1.0, 0.0] {
| ~~~~~~~ ~~~~~~~~~~
|
deref which would be done by auto-deref:
pdf/src/object/types.rs#L323
warning: deref which would be done by auto-deref
--> pdf/src/object/types.rs:323:29
|
323 | None => inherit(&*self.parent, |pt| pt.resources.as_ref())?
| ^^^^^^^^^^^^^ help: try this: `&self.parent`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
|
deref which would be done by auto-deref:
pdf/src/object/types.rs#L314
warning: deref which would be done by auto-deref
--> pdf/src/object/types.rs:314:35
|
314 | None => match inherit(&*self.parent, |pt| pt.crop_box)? {
| ^^^^^^^^^^^^^ help: try this: `&self.parent`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
|
deref which would be done by auto-deref:
pdf/src/object/types.rs#L307
warning: deref which would be done by auto-deref
--> pdf/src/object/types.rs:307:29
|
307 | None => inherit(&*self.parent, |pt| pt.media_box)?
| ^^^^^^^^^^^^^ help: try this: `&self.parent`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
= note: `#[warn(clippy::explicit_auto_deref)]` on by default
|
unused variable: `cid`:
pdf/src/font.rs#L674
warning: unused variable: `cid`
--> pdf/src/font.rs:674:27
|
674 | for (i, &(cid, u)) in block.iter().enumerate() {
| ^^^ help: if this is intentional, prefix it with an underscore: `_cid`
|
unused variable: `parse_options`:
pdf/src/file.rs#L548
warning: unused variable: `parse_options`
--> pdf/src/file.rs:548:45
|
548 | let FileOptions { oc, sc, password, parse_options, log } = self;
| ^^^^^^^^^^^^^ help: try ignoring the field: `parse_options: _`
|
unused variable: `password`:
pdf/src/file.rs#L548
warning: unused variable: `password`
--> pdf/src/file.rs:548:35
|
548 | let FileOptions { oc, sc, password, parse_options, log } = self;
| ^^^^^^^^ help: try ignoring the field: `password: _`
|
unused variable: `depth`:
pdf/src/file.rs#L284
warning: unused variable: `depth`
--> pdf/src/file.rs:284:61
|
284 | fn resolve_flags(&self, r: PlainRef, flags: ParseFlags, depth: usize) -> Result<Primitive> {
| ^^^^^ help: if this is intentional, prefix it with an underscore: `_depth`
|
unused variable: `r`:
pdf/src/file.rs#L60
warning: unused variable: `r`
--> pdf/src/file.rs:60:23
|
60 | fn log_get(&self, r: PlainRef) {}
| ^ help: if this is intentional, prefix it with an underscore: `_r`
|
unused variable: `r`:
pdf/src/file.rs#L59
warning: unused variable: `r`
--> pdf/src/file.rs:59:27
|
59 | fn load_object(&self, r: PlainRef) {}
| ^ help: if this is intentional, prefix it with an underscore: `_r`
|
unused variable: `key`:
pdf/src/file.rs#L46
warning: unused variable: `key`
--> pdf/src/file.rs:46:30
|
46 | fn get_or_compute(&self, key: PlainRef, compute: impl FnOnce() -> T) -> T {
| ^^^ help: if this is intentional, prefix it with an underscore: `_key`
|
unused variable: `update`:
pdf/src/primitive.rs#L783
warning: unused variable: `update`
--> pdf/src/primitive.rs:783:28
|
783 | fn to_primitive(&self, update: &mut impl Updater) -> Result<Primitive> {
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_update`
|
unused variable: `file_range`:
pdf/src/primitive.rs#L264
warning: unused variable: `file_range`
--> pdf/src/primitive.rs:264:39
|
264 | StreamInner::InFile { id, ref file_range } => {
| ^^^^^^^^^^^^^^ help: try ignoring the field: `file_range: _`
|
unused variable: `id`:
pdf/src/primitive.rs#L264
warning: unused variable: `id`
--> pdf/src/primitive.rs:264:35
|
264 | StreamInner::InFile { id, ref file_range } => {
| ^^ help: try ignoring the field: `id: _`
|
unused variable: `offset`:
pdf/src/file.rs#L213
warning: unused variable: `offset`
--> pdf/src/file.rs:213:43
|
213 | ... if let Ok(offset) = lexer.next() {
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_offset`
|
= note: `#[warn(unused_variables)]` on by default
|
unused import: `std::fmt`:
pdf/src/font.rs#L7
warning: unused import: `std::fmt`
--> pdf/src/font.rs:7:5
|
7 | use std::fmt;
| ^^^^^^^^
|
private item shadows public glob re-export:
pdf/src/parser/mod.rs#L15
warning: private item shadows public glob re-export
--> pdf/src/parser/mod.rs:15:35
|
15 | use self::lexer::{HexStringLexer, StringLexer};
| ^^^^^^^^^^^
|
note: the name `StringLexer` in the type namespace is supposed to be publicly re-exported here
--> pdf/src/parser/mod.rs:7:9
|
7 | pub use self::lexer::*;
| ^^^^^^^^^^^^^^
note: but the private item here shadows it
--> pdf/src/parser/mod.rs:15:35
|
15 | use self::lexer::{HexStringLexer, StringLexer};
| ^^^^^^^^^^^
|
private item shadows public glob re-export:
pdf/src/parser/mod.rs#L15
warning: private item shadows public glob re-export
--> pdf/src/parser/mod.rs:15:19
|
15 | use self::lexer::{HexStringLexer, StringLexer};
| ^^^^^^^^^^^^^^
|
note: the name `HexStringLexer` in the type namespace is supposed to be publicly re-exported here
--> pdf/src/parser/mod.rs:7:9
|
7 | pub use self::lexer::*;
| ^^^^^^^^^^^^^^
note: but the private item here shadows it
--> pdf/src/parser/mod.rs:15:19
|
15 | use self::lexer::{HexStringLexer, StringLexer};
| ^^^^^^^^^^^^^^
= note: `#[warn(hidden_glob_reexports)]` on by default
|
unused import: `std::cell::RefCell`:
pdf/src/file.rs#L2
warning: unused import: `std::cell::RefCell`
--> pdf/src/file.rs:2:5
|
2 | use std::cell::RefCell;
| ^^^^^^^^^^^^^^^^^^
|
unused imports: `BTreeMap`, `btree_map`:
pdf/src/primitive.rs#L4
warning: unused imports: `BTreeMap`, `btree_map`
--> pdf/src/primitive.rs:4:24
|
4 | use std::collections::{btree_map, BTreeMap};
| ^^^^^^^^^ ^^^^^^^^
|
unused import: `RcRef`:
pdf/src/primitive.rs#L2
warning: unused import: `RcRef`
--> pdf/src/primitive.rs:2:81
|
2 | use crate::object::{PlainRef, Resolve, Object, NoResolve, ObjectWrite, Updater, RcRef};
| ^^^^^
|
= note: `#[warn(unused_imports)]` on by default
|
this `if` statement can be collapsed:
pdf/src/object/types.rs#L621
warning: this `if` statement can be collapsed
--> pdf/src/object/types.rs:621:13
|
621 | / if &*decode == &[1.0, 0.0] {
622 | | if self.bits_per_component == Some(1) {
623 | | data.iter_mut().for_each(|b| *b = !*b);
624 | | }
625 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
= note: `#[warn(clippy::collapsible_if)]` on by default
help: collapse nested if block
|
621 ~ if &*decode == &[1.0, 0.0] && self.bits_per_component == Some(1) {
622 + data.iter_mut().for_each(|b| *b = !*b);
623 + }
|
|
dereferencing a tuple pattern where every element takes a reference:
pdf_derive/src/lib.rs#L643
warning: dereferencing a tuple pattern where every element takes a reference
--> pdf_derive/src/lib.rs:643:48
|
643 | let checks_code = attrs.checks.iter().map(|&(ref key, ref val)|
| ^^^^^^^^^^^^^^^^^^^
|
= 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
|
643 - let checks_code = attrs.checks.iter().map(|&(ref key, ref val)|
643 + let checks_code = attrs.checks.iter().map(|(key, val)|
|
|
dereferencing a tuple pattern where every element takes a reference:
pdf_derive/src/lib.rs#L618
warning: dereferencing a tuple pattern where every element takes a reference
--> pdf_derive/src/lib.rs:618:12
|
618 | .map( |&(ref field, ref attrs, ref opt)|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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
|
618 - .map( |&(ref field, ref attrs, ref opt)|
618 + .map( |(field, attrs, opt)|
|
|
dereferencing a tuple pattern where every element takes a reference:
pdf_derive/src/lib.rs#L574
warning: dereferencing a tuple pattern where every element takes a reference
--> pdf_derive/src/lib.rs:574:51
|
574 | let checks: Vec<_> = attrs.checks.iter().map(|&(ref key, ref val)|
| ^^^^^^^^^^^^^^^^^^^
|
= 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
|
574 - let checks: Vec<_> = attrs.checks.iter().map(|&(ref key, ref val)|
574 + let checks: Vec<_> = attrs.checks.iter().map(|(key, val)|
|
|
unused variable: `opt`:
pdf_derive/src/lib.rs#L618
warning: unused variable: `opt`
--> pdf_derive/src/lib.rs:618:40
|
618 | .map( |&(ref field, ref attrs, ref opt)|
| ^^^ help: if this is intentional, prefix it with an underscore: `_opt`
|
= note: `#[warn(unused_variables)]` on by default
|
dereferencing a tuple pattern where every element takes a reference:
pdf_derive/src/lib.rs#L643
warning: dereferencing a tuple pattern where every element takes a reference
--> pdf_derive/src/lib.rs:643:48
|
643 | let checks_code = attrs.checks.iter().map(|&(ref key, ref val)|
| ^^^^^^^^^^^^^^^^^^^
|
= 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
|
643 - let checks_code = attrs.checks.iter().map(|&(ref key, ref val)|
643 + let checks_code = attrs.checks.iter().map(|(key, val)|
|
|
dereferencing a tuple pattern where every element takes a reference:
pdf_derive/src/lib.rs#L618
warning: dereferencing a tuple pattern where every element takes a reference
--> pdf_derive/src/lib.rs:618:12
|
618 | .map( |&(ref field, ref attrs, ref opt)|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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
|
618 - .map( |&(ref field, ref attrs, ref opt)|
618 + .map( |(field, attrs, opt)|
|
|
dereferencing a tuple pattern where every element takes a reference:
pdf_derive/src/lib.rs#L574
warning: dereferencing a tuple pattern where every element takes a reference
--> pdf_derive/src/lib.rs:574:51
|
574 | let checks: Vec<_> = attrs.checks.iter().map(|&(ref key, ref val)|
| ^^^^^^^^^^^^^^^^^^^
|
= 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
|
574 - let checks: Vec<_> = attrs.checks.iter().map(|&(ref key, ref val)|
574 + let checks: Vec<_> = attrs.checks.iter().map(|(key, val)|
|
|
unnecessary hashes around raw string literal:
pdf_derive/src/lib.rs#L179
warning: unnecessary hashes around raw string literal
--> pdf_derive/src/lib.rs:179:33
|
179 | ...> panic!(r##"Derive error - Supported derive attributes: `key="Key"`, `default="some code", skip, other, indirect`."##)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `r#"Derive error - Supported derive attributes: `key="Key"`, `default="some code", skip, other, indirect`."#`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
= note: `#[warn(clippy::needless_raw_string_hashes)]` on by default
|
unused variable: `opt`:
pdf_derive/src/lib.rs#L618
warning: unused variable: `opt`
--> pdf_derive/src/lib.rs:618:40
|
618 | .map( |&(ref field, ref attrs, ref opt)|
| ^^^ help: if this is intentional, prefix it with an underscore: `_opt`
|
= note: `#[warn(unused_variables)]` on by default
|
unnecessary hashes around raw string literal:
pdf_derive/src/lib.rs#L179
warning: unnecessary hashes around raw string literal
--> pdf_derive/src/lib.rs:179:33
|
179 | ...> panic!(r##"Derive error - Supported derive attributes: `key="Key"`, `default="some code", skip, other, indirect`."##)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `r#"Derive error - Supported derive attributes: `key="Key"`, `default="some code", skip, other, indirect`."#`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
= note: `#[warn(clippy::needless_raw_string_hashes)]` on by default
|
tests
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions/cache@v2, actions-rs/toolchain@v1, actions-rs/cargo@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
tests:
pdf_derive/src/lib.rs#L618
unused variable: `opt`
|
tests
`pdf_derive` (lib) generated 1 warning (run `cargo fix --lib -p pdf_derive` to apply 1 suggestion)
|
tests:
pdf/src/primitive.rs#L2
unused import: `RcRef`
|
tests:
pdf/src/primitive.rs#L4
unused imports: `BTreeMap`, `btree_map`
|
tests:
pdf/src/file.rs#L2
unused import: `std::cell::RefCell`
|
tests:
pdf/src/parser/mod.rs#L15
private item shadows public glob re-export
|
tests:
pdf/src/parser/mod.rs#L15
private item shadows public glob re-export
|
tests:
pdf/src/font.rs#L7
unused import: `std::fmt`
|
tests:
pdf/src/file.rs#L213
unused variable: `offset`
|
tests:
pdf/src/primitive.rs#L264
unused variable: `id`
|
tests
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
tests
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
tests
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|
tests
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
|