Skip to content

Commit

Permalink
Fixed clippy 1.83 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ancwrd1 committed Nov 28, 2024
1 parent 0266aaf commit cedcf63
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion qpdf-rs/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub struct QPdfArrayIterator<'a> {
inner: &'a QPdfArray,
}

impl<'a> Iterator for QPdfArrayIterator<'a> {
impl Iterator for QPdfArrayIterator<'_> {
type Item = QPdfObject;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
7 changes: 4 additions & 3 deletions qpdf-rs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::manual_c_str_literals)]
#![doc = include_str!("../README.md")]

use std::{
Expand Down Expand Up @@ -473,7 +474,7 @@ impl QPdf {
let oh = unsafe { qpdf_sys::qpdf_oh_new_dictionary(self.inner()) };
let dict = QPdfDictionary::new(QPdfObject::new(self.clone(), oh));
for item in iter.into_iter() {
dict.set(item.0.as_ref(), &item.1.into());
dict.set(item.0.as_ref(), item.1.into());
}
dict
}
Expand All @@ -482,7 +483,7 @@ impl QPdf {
pub fn new_stream<D: AsRef<[u8]>>(self: &QPdf, data: D) -> QPdfStream {
let oh = unsafe { qpdf_sys::qpdf_oh_new_stream(self.inner()) };
let obj: QPdfStream = QPdfObject::new(self.clone(), oh).into();
obj.replace_data(data, &self.new_null(), &self.new_null());
obj.replace_data(data, self.new_null(), self.new_null());
obj
}

Expand All @@ -497,7 +498,7 @@ impl QPdf {
let stream = self.new_stream(data.as_ref());
let dict = stream.get_dictionary();
for item in iter.into_iter() {
dict.set(item.0.as_ref(), &item.1.into());
dict.set(item.0.as_ref(), item.1.into());
}
drop(dict);
stream
Expand Down
12 changes: 6 additions & 6 deletions qpdf-rs/tests/test_qpdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn test_pdf_from_scratch() {
("/Resources", resources.into()),
]);

qpdf.add_page(&page.into_indirect(), true).unwrap();
qpdf.add_page(page.into_indirect(), true).unwrap();

let mem = qpdf
.writer()
Expand Down Expand Up @@ -112,7 +112,7 @@ fn test_qpdf_basic_objects() {
assert_eq!(obj.get_type(), QPdfObjectType::Stream);
assert_eq!(obj.to_string(), "3 0 R");

obj.get_dictionary().set("/Type", &qpdf.new_name("/Stream"));
obj.get_dictionary().set("/Type", qpdf.new_name("/Stream"));

let obj_id = obj.get_id();
assert_ne!(obj.into_indirect().get_id(), obj_id);
Expand Down Expand Up @@ -168,9 +168,9 @@ fn test_error() {
fn test_array() {
let qpdf = QPdf::empty();
let mut arr = qpdf.new_array();
arr.push(&qpdf.new_integer(1));
arr.push(&qpdf.new_integer(2));
arr.push(&qpdf.new_integer(3));
arr.push(qpdf.new_integer(1));
arr.push(qpdf.new_integer(2));
arr.push(qpdf.new_integer(3));
assert_eq!(arr.to_string(), "[ 1 2 3 ]");

assert!(arr.get(10).is_none());
Expand All @@ -180,7 +180,7 @@ fn test_array() {
vec![1, 2, 3]
);

arr.set(1, &qpdf.new_integer(5));
arr.set(1, qpdf.new_integer(5));
assert_eq!(arr.to_string(), "[ 1 5 3 ]");
}

Expand Down

0 comments on commit cedcf63

Please sign in to comment.