Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Heinenen committed Dec 4, 2024
1 parent eb686ed commit fb312d1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
8 changes: 2 additions & 6 deletions examples/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ fn main() {
let pages = doc.get_pages();

// This is actually better than extend as we use less allocations and cloning then.
pages
.into_iter()
.map(|(_, object_id)| {
pages.into_values().map(|object_id| {
// We use this as the return object for Bookmarking to deturmine what it points too.
// We only want to do this for the first page though.
if first_object.is_none() {
Expand Down Expand Up @@ -250,9 +248,7 @@ fn main() {
// Set new "Kids" list (collected from documents pages) for "Pages"
dictionary.set(
"Kids",
documents_pages
.into_iter()
.map(|(object_id, _)| Object::Reference(object_id))
documents_pages.into_keys().map(|object_id| Object::Reference(object_id))
.collect::<Vec<_>>(),
);

Expand Down
4 changes: 2 additions & 2 deletions src/encodings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub enum Encoding<'a> {
UnicodeMapEncoding(ToUnicodeCMap),
}

impl<'a> std::fmt::Debug for Encoding<'a> {
impl std::fmt::Debug for Encoding<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
// UnicodeCMap and Bytes encoding ommitted to not bloat debug log
Expand All @@ -42,7 +42,7 @@ impl<'a> std::fmt::Debug for Encoding<'a> {
}
}

impl<'a> Encoding<'a> {
impl Encoding<'_> {
pub fn bytes_to_string(&self, bytes: &[u8]) -> Result<String> {
match self {
Self::OneByteEncoding(map) => Ok(bytes_to_string(map, bytes)),
Expand Down
2 changes: 1 addition & 1 deletion src/parser/cmap_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn cmap_stream(input: ParserInput) -> NomResult<Vec<CMapSection>> {
)(input)
}

fn tuple_discard_result<'a, O, List>(seq: List, input: ParserInput<'a>) -> NomResult<()>
fn tuple_discard_result<'a, O, List>(seq: List, input: ParserInput<'a>) -> NomResult<'a, ()>
where
List: nom::sequence::Tuple<ParserInput<'a>, O, NomError<'a>>,
{
Expand Down
2 changes: 1 addition & 1 deletion src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ enum InnerLiteralString<'a> {
Nested(Vec<u8>),
}

impl<'a> InnerLiteralString<'a> {
impl InnerLiteralString<'_> {
fn push(&self, output: &mut Vec<u8>) {
match self {
InnerLiteralString::Direct(s) | InnerLiteralString::Eol(s) => output.extend_from_slice(s),
Expand Down
2 changes: 1 addition & 1 deletion src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ pub struct Reader<'a> {
/// Maximum allowed embedding of literal strings.
pub const MAX_BRACKET: usize = 100;

impl<'a> Reader<'a> {
impl Reader<'_> {
/// Read whole document.
pub fn read(mut self, filter_func: Option<FilterFunc>) -> Result<Document> {
// The document structure can be expressed in PEG as:
Expand Down

0 comments on commit fb312d1

Please sign in to comment.