Skip to content

remove error::trace #145

remove error::trace

remove error::trace #145

GitHub Actions / clippy succeeded Dec 14, 2023 in 1s

clippy

42 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 42
Note 0
Help 0

Versions

  • rustc 1.74.1 (a28077b28 2023-12-04)
  • cargo 1.74.1 (ecb9851af 2023-10-18)
  • clippy 0.1.74 (a28077b 2023-12-04)

Annotations

Check warning on line 77 in examples/src/bin/extract_page.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

field assignment outside of initializer for an instance created with Default::default()

warning: field assignment outside of initializer for an instance created with Default::default()
  --> examples/src/bin/extract_page.rs:77:5
   |
77 |     info.title = Some(PdfString::from("test"));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: consider initializing the variable with `pdf::object::InfoDict { title: Some(PdfString::from("test")), ..Default::default() }` and removing relevant reassignments
  --> examples/src/bin/extract_page.rs:76:5
   |
76 |     let mut info = InfoDict::default();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
   = note: `#[warn(clippy::field_reassign_with_default)]` on by default

Check warning on line 74 in examples/src/bin/form.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> examples/src/bin/form.rs:51:17
   |
51 | /                 match *normal {
52 | |                     AppearanceStreamEntry::Single(ref s) => {
53 | |                         //dbg!(&s.stream.resources);
54 | |                         
...  |
73 | |                     _ => {}
74 | |                 }
   | |_________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
   = note: `#[warn(clippy::single_match)]` on by default
help: try
   |
51 ~                 if let AppearanceStreamEntry::Single(ref s) = *normal {
52 +                     //dbg!(&s.stream.resources);
53 +                     
54 +                     let form_dict = FormDict {
55 +                         resources: Some(resources.clone().into()),
56 +                         .. (**s.stream).clone()
57 +                     };
58 + 
59 +                     let ops = vec![
60 +                         Op::Save,
61 +                         Op::TextFont { name: font_name.clone(), size: 14.0 },
62 +                         Op::TextDraw { text: PdfString::from("Hello World!") },
63 +                         Op::EndText,
64 +                         Op::Restore
65 +                     ];
66 +                     let stream = Stream::new(form_dict, serialize_ops(&ops)?);
67 + 
68 +                     let normal2 = AppearanceStreamEntry::Single(FormXObject { stream });
69 + 
70 +                     file.update(a.normal.get_inner(), normal2)?;
71 +                 }
   |

Check warning on line 107 in examples/src/bin/form.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `reference`

warning: unused variable: `reference`
   --> examples/src/bin/form.rs:107:13
    |
107 |         let reference = file.update(
    |             ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_reference`
    |
    = note: `#[warn(unused_variables)]` on by default

Check warning on line 8 in examples/src/bin/form.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `Log`

warning: unused import: `Log`
 --> examples/src/bin/form.rs:8:30
  |
8 | use pdf::file::{FileOptions, Log};
  |                              ^^^
  |
  = note: `#[warn(unused_imports)]` on by default

Check warning on line 268 in pdf/src/build.rs

See this annotation in the file changed.

@github-actions 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/build.rs:268:36
    |
268 |                 match self.map.get(&r1) {
    |                                    ^^^ help: change this to: `r1`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 759 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression borrows a value the compiler would automatically borrow

warning: this expression borrows a value the compiler would automatically borrow
   --> pdf/src/object/mod.rs:759:21
    |
759 |         Ok(Box::new((&**self).deep_clone(cloner)?))
    |                     ^^^^^^^^^ help: change this to: `(**self)`
    |
    = 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 602 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec`

warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec`
   --> pdf/src/object/mod.rs:602:70
    |
602 |             Primitive::Array(ref parts) => Ok(Primitive::Array(parts.into_iter().map(|p| p.deep_clone(cloner)).try_collect()?)),
    |                                                                      ^^^^^^^^^ help: call directly: `iter`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
    = note: `#[warn(clippy::into_iter_on_ref)]` on by default

Check warning on line 397 in pdf/src/build.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `old`

warning: unused variable: `old`
   --> pdf/src/build.rs:397:22
    |
397 |         if let Some((old, new)) = self.shared.get(&key) {
    |                      ^^^ help: if this is intentional, prefix it with an underscore: `_old`

Check warning on line 105 in pdf/src/encoding.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cloner`

warning: unused variable: `cloner`
   --> pdf/src/encoding.rs:105:26
    |
105 |     fn deep_clone(&self, cloner: &mut impl pdf::object::Cloner) -> Result<Self> {
    |                          ^^^^^^ help: if this is intentional, prefix it with an underscore: `_cloner`

Check warning on line 270 in pdf/src/primitive.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `update`

warning: unused variable: `update`
   --> pdf/src/primitive.rs:270:28
    |
270 |     fn to_primitive(&self, update: &mut impl Updater) -> Result<Primitive> {
    |                            ^^^^^^ help: if this is intentional, prefix it with an underscore: `_update`

Check warning on line 766 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cloner`

warning: unused variable: `cloner`
   --> pdf/src/object/mod.rs:766:38
    |
766 |                 fn deep_clone(&self, cloner: &mut impl Cloner) -> Result<Self> {
    |                                      ^^^^^^ help: if this is intentional, prefix it with an underscore: `_cloner`
...
773 | deep_clone_simple!(f32, i32, u32, bool, Name, (), Date, PdfString, Rect, u8, Arc<[u8]>, Vec<u16>);
    | ------------------------------------------------------------------------------------------------- in this macro invocation
    |
    = note: this warning originates in the macro `deep_clone_simple` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 766 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cloner`

warning: unused variable: `cloner`
   --> pdf/src/object/mod.rs:766:38
    |
766 |                 fn deep_clone(&self, cloner: &mut impl Cloner) -> Result<Self> {
    |                                      ^^^^^^ help: if this is intentional, prefix it with an underscore: `_cloner`
...
773 | deep_clone_simple!(f32, i32, u32, bool, Name, (), Date, PdfString, Rect, u8, Arc<[u8]>, Vec<u16>);
    | ------------------------------------------------------------------------------------------------- in this macro invocation
    |
    = note: this warning originates in the macro `deep_clone_simple` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 766 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cloner`

warning: unused variable: `cloner`
   --> pdf/src/object/mod.rs:766:38
    |
766 |                 fn deep_clone(&self, cloner: &mut impl Cloner) -> Result<Self> {
    |                                      ^^^^^^ help: if this is intentional, prefix it with an underscore: `_cloner`
...
773 | deep_clone_simple!(f32, i32, u32, bool, Name, (), Date, PdfString, Rect, u8, Arc<[u8]>, Vec<u16>);
    | ------------------------------------------------------------------------------------------------- in this macro invocation
    |
    = note: this warning originates in the macro `deep_clone_simple` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 766 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cloner`

warning: unused variable: `cloner`
   --> pdf/src/object/mod.rs:766:38
    |
766 |                 fn deep_clone(&self, cloner: &mut impl Cloner) -> Result<Self> {
    |                                      ^^^^^^ help: if this is intentional, prefix it with an underscore: `_cloner`
...
773 | deep_clone_simple!(f32, i32, u32, bool, Name, (), Date, PdfString, Rect, u8, Arc<[u8]>, Vec<u16>);
    | ------------------------------------------------------------------------------------------------- in this macro invocation
    |
    = note: this warning originates in the macro `deep_clone_simple` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 766 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cloner`

warning: unused variable: `cloner`
   --> pdf/src/object/mod.rs:766:38
    |
766 |                 fn deep_clone(&self, cloner: &mut impl Cloner) -> Result<Self> {
    |                                      ^^^^^^ help: if this is intentional, prefix it with an underscore: `_cloner`
...
773 | deep_clone_simple!(f32, i32, u32, bool, Name, (), Date, PdfString, Rect, u8, Arc<[u8]>, Vec<u16>);
    | ------------------------------------------------------------------------------------------------- in this macro invocation
    |
    = note: this warning originates in the macro `deep_clone_simple` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 766 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cloner`

warning: unused variable: `cloner`
   --> pdf/src/object/mod.rs:766:38
    |
766 |                 fn deep_clone(&self, cloner: &mut impl Cloner) -> Result<Self> {
    |                                      ^^^^^^ help: if this is intentional, prefix it with an underscore: `_cloner`
...
773 | deep_clone_simple!(f32, i32, u32, bool, Name, (), Date, PdfString, Rect, u8, Arc<[u8]>, Vec<u16>);
    | ------------------------------------------------------------------------------------------------- in this macro invocation
    |
    = note: this warning originates in the macro `deep_clone_simple` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 766 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cloner`

warning: unused variable: `cloner`
   --> pdf/src/object/mod.rs:766:38
    |
766 |                 fn deep_clone(&self, cloner: &mut impl Cloner) -> Result<Self> {
    |                                      ^^^^^^ help: if this is intentional, prefix it with an underscore: `_cloner`
...
773 | deep_clone_simple!(f32, i32, u32, bool, Name, (), Date, PdfString, Rect, u8, Arc<[u8]>, Vec<u16>);
    | ------------------------------------------------------------------------------------------------- in this macro invocation
    |
    = note: this warning originates in the macro `deep_clone_simple` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 766 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cloner`

warning: unused variable: `cloner`
   --> pdf/src/object/mod.rs:766:38
    |
766 |                 fn deep_clone(&self, cloner: &mut impl Cloner) -> Result<Self> {
    |                                      ^^^^^^ help: if this is intentional, prefix it with an underscore: `_cloner`
...
773 | deep_clone_simple!(f32, i32, u32, bool, Name, (), Date, PdfString, Rect, u8, Arc<[u8]>, Vec<u16>);
    | ------------------------------------------------------------------------------------------------- in this macro invocation
    |
    = note: this warning originates in the macro `deep_clone_simple` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 766 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cloner`

warning: unused variable: `cloner`
   --> pdf/src/object/mod.rs:766:38
    |
766 |                 fn deep_clone(&self, cloner: &mut impl Cloner) -> Result<Self> {
    |                                      ^^^^^^ help: if this is intentional, prefix it with an underscore: `_cloner`
...
773 | deep_clone_simple!(f32, i32, u32, bool, Name, (), Date, PdfString, Rect, u8, Arc<[u8]>, Vec<u16>);
    | ------------------------------------------------------------------------------------------------- in this macro invocation
    |
    = note: this warning originates in the macro `deep_clone_simple` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 766 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cloner`

warning: unused variable: `cloner`
   --> pdf/src/object/mod.rs:766:38
    |
766 |                 fn deep_clone(&self, cloner: &mut impl Cloner) -> Result<Self> {
    |                                      ^^^^^^ help: if this is intentional, prefix it with an underscore: `_cloner`
...
773 | deep_clone_simple!(f32, i32, u32, bool, Name, (), Date, PdfString, Rect, u8, Arc<[u8]>, Vec<u16>);
    | ------------------------------------------------------------------------------------------------- in this macro invocation
    |
    = note: this warning originates in the macro `deep_clone_simple` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 766 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cloner`

warning: unused variable: `cloner`
   --> pdf/src/object/mod.rs:766:38
    |
766 |                 fn deep_clone(&self, cloner: &mut impl Cloner) -> Result<Self> {
    |                                      ^^^^^^ help: if this is intentional, prefix it with an underscore: `_cloner`
...
773 | deep_clone_simple!(f32, i32, u32, bool, Name, (), Date, PdfString, Rect, u8, Arc<[u8]>, Vec<u16>);
    | ------------------------------------------------------------------------------------------------- in this macro invocation
    |
    = note: this warning originates in the macro `deep_clone_simple` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 766 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cloner`

warning: unused variable: `cloner`
   --> pdf/src/object/mod.rs:766:38
    |
766 |                 fn deep_clone(&self, cloner: &mut impl Cloner) -> Result<Self> {
    |                                      ^^^^^^ help: if this is intentional, prefix it with an underscore: `_cloner`
...
773 | deep_clone_simple!(f32, i32, u32, bool, Name, (), Date, PdfString, Rect, u8, Arc<[u8]>, Vec<u16>);
    | ------------------------------------------------------------------------------------------------- in this macro invocation
    |
    = note: this warning originates in the macro `deep_clone_simple` (in Nightly builds, run with -Z macro-backtrace for more info)

Check warning on line 85 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `range`

warning: unused variable: `range`
  --> pdf/src/object/mod.rs:85:41
   |
85 |     fn stream_data(&self, id: PlainRef, range: Range<usize>) -> Result<Arc<[u8]>> {
   |                                         ^^^^^ help: if this is intentional, prefix it with an underscore: `_range`

Check warning on line 85 in pdf/src/object/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `id`

warning: unused variable: `id`
  --> pdf/src/object/mod.rs:85:27
   |
85 |     fn stream_data(&self, id: PlainRef, range: Range<usize>) -> Result<Arc<[u8]>> {
   |                           ^^ help: if this is intentional, prefix it with an underscore: `_id`

Check warning on line 208 in pdf/src/object/function.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cloner`

warning: unused variable: `cloner`
   --> pdf/src/object/function.rs:208:26
    |
208 |     fn deep_clone(&self, cloner: &mut impl Cloner) -> Result<Self> {
    |                          ^^^^^^ help: if this is intentional, prefix it with an underscore: `_cloner`