Skip to content

Commit 178a58a

Browse files
committed
Bump Rust in CI and fix clippy lints
1 parent 4ba9e07 commit 178a58a

16 files changed

+76
-78
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v4
10-
- uses: dtolnay/rust-toolchain@1.77.0
10+
- uses: dtolnay/rust-toolchain@1.83.0
1111
- uses: Swatinem/rust-cache@v2
1212
- run: cargo test --no-run
1313
- run: cargo test --no-fail-fast
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v4
20-
- uses: dtolnay/rust-toolchain@1.77.0
20+
- uses: dtolnay/rust-toolchain@1.83.0
2121
with:
2222
components: clippy, rustfmt
2323
- uses: Swatinem/rust-cache@v2

src/actions.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ writer!(Action: |obj| {
1414
Self { dict }
1515
});
1616

17-
impl<'a> Action<'a> {
17+
impl Action<'_> {
1818
/// Write the `/S` attribute to set the action type.
1919
pub fn action_type(&mut self, kind: ActionType) -> &mut Self {
2020
self.pair(Name(b"S"), kind.to_name());
@@ -147,7 +147,7 @@ pub struct Fields<'a> {
147147

148148
writer!(Fields: |obj| Self { array: obj.array() });
149149

150-
impl<'a> Fields<'a> {
150+
impl Fields<'_> {
151151
/// The indirect reference to the field.
152152
pub fn id(&mut self, id: Ref) -> &mut Self {
153153
self.array.item(id);
@@ -299,7 +299,7 @@ pub struct AdditionalActions<'a> {
299299
writer!(AdditionalActions: |obj| Self { dict: obj.dict() });
300300

301301
/// Only permissible for [annotations](Annotation).
302-
impl<'a> AdditionalActions<'a> {
302+
impl AdditionalActions<'_> {
303303
/// Start writing the `/E` dictionary. An action that shall be performed
304304
/// when the cursor enters the annotation's active area. Only permissible
305305
/// for annotations. PDF 1.2+.
@@ -360,7 +360,7 @@ impl<'a> AdditionalActions<'a> {
360360

361361
/// Only permissible for [widget](crate::types::AnnotationType::Widget)
362362
/// [annotations](Annotation).
363-
impl<'a> AdditionalActions<'a> {
363+
impl AdditionalActions<'_> {
364364
/// Start writing the `/Fo` dictionary. This sets the action that shall be
365365
/// performed when the annotation receives the input focus. Only permissible
366366
/// for widget annotations. PDF 1.2+.
@@ -377,7 +377,7 @@ impl<'a> AdditionalActions<'a> {
377377
}
378378

379379
/// Only permissible for [page objects](Page).
380-
impl<'a> AdditionalActions<'a> {
380+
impl AdditionalActions<'_> {
381381
/// Start writing the `/O` dictionary. This sets the action that shall be
382382
/// performed when the page is opened. This action is independent of any
383383
/// that may be defined by the open action entry in the
@@ -397,7 +397,7 @@ impl<'a> AdditionalActions<'a> {
397397
}
398398

399399
/// Only permisible for form fields.
400-
impl<'a> AdditionalActions<'a> {
400+
impl AdditionalActions<'_> {
401401
/// Start writing the `/K` dictionary. This sets the JavaScript action that
402402
/// shall be performed when the user modifies a character in a text field
403403
/// or combo box or modifies the selection in a scrollable list box. This
@@ -434,7 +434,7 @@ impl<'a> AdditionalActions<'a> {
434434
}
435435

436436
/// Only permisible for [document catalog](Catalog).
437-
impl<'a> AdditionalActions<'a> {
437+
impl AdditionalActions<'_> {
438438
/// Start writing the `/WC` dictionary. This sets the JavaScript action
439439
/// that shall be performed before closing a document. Only permissible for
440440
/// the [document catalog](Catalog) PDF 1.4+.

src/annotations.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ writer!(Annotation: |obj| {
1313
Self { dict }
1414
});
1515

16-
impl<'a> Annotation<'a> {
16+
impl Annotation<'_> {
1717
/// Write the `/Subtype` attribute to tell the viewer the type of this
1818
/// particular annotation.
1919
pub fn subtype(&mut self, kind: AnnotationType) -> &mut Self {
@@ -396,7 +396,7 @@ pub struct AppearanceCharacteristics<'a> {
396396

397397
writer!(AppearanceCharacteristics: |obj| Self { dict: obj.dict() });
398398

399-
impl<'a> AppearanceCharacteristics<'a> {
399+
impl AppearanceCharacteristics<'_> {
400400
/// Write the `/R` attribute. This is the number of degrees the widget
401401
/// annotation should be rotated by counterclockwise relative to its page
402402
/// when displayed. This should be a multiple of 90.
@@ -552,7 +552,7 @@ pub struct IconFit<'a> {
552552

553553
writer!(IconFit: |obj| Self { dict: obj.dict() });
554554

555-
impl<'a> IconFit<'a> {
555+
impl IconFit<'_> {
556556
/// Write the `/SW` attribute. This sets under which circumstances the icon
557557
/// of the widget annotation should be scaled.
558558
pub fn scale(&mut self, value: IconScale) -> &mut Self {
@@ -668,7 +668,7 @@ pub struct Appearance<'a> {
668668

669669
writer!(Appearance: |obj| Self { dict: obj.dict() });
670670

671-
impl<'a> Appearance<'a> {
671+
impl Appearance<'_> {
672672
/// Start writing the `/N` stream or dictionary to set the annotation's
673673
/// normal appearance.
674674
pub fn normal(&mut self) -> AppearanceEntry<'_> {
@@ -729,7 +729,7 @@ writer!(BorderStyle: |obj| {
729729
Self { dict }
730730
});
731731

732-
impl<'a> BorderStyle<'a> {
732+
impl BorderStyle<'_> {
733733
/// Write the `/W` attribute. This is the width of the border in points.
734734
pub fn width(&mut self, points: f32) -> &mut Self {
735735
self.pair(Name(b"W"), points);

src/attributes.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub struct UserProperty<'a> {
6060

6161
writer!(UserProperty: |obj| Self { dict: obj.dict() });
6262

63-
impl<'a> UserProperty<'a> {
63+
impl UserProperty<'_> {
6464
/// Write the `/N` attribute to set the name of the property.
6565
pub fn name(&mut self, name: TextStr) -> &mut Self {
6666
self.dict.pair(Name(b"N"), name);
@@ -400,7 +400,7 @@ impl BlockAlign {
400400
}
401401

402402
/// Grouping elements.
403-
impl<'a> LayoutAttributes<'a> {
403+
impl LayoutAttributes<'_> {
404404
/// Write the `/ColumnCount` attribute. PDF 1.6+.
405405
pub fn column_count(&mut self, count: i32) -> &mut Self {
406406
self.dict.pair(Name(b"ColumnCount"), count);

src/color.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ writer!(ShadingPattern: |obj| {
898898
Self { dict }
899899
});
900900

901-
impl<'a> ShadingPattern<'a> {
901+
impl ShadingPattern<'_> {
902902
/// Start writing the `/Shading` dictionary for a type 1, 2, or 3 shading.
903903
pub fn function_shading(&mut self) -> FunctionShading<'_> {
904904
self.dict.insert(Name(b"Shading")).start()
@@ -936,7 +936,7 @@ pub struct FunctionShading<'a> {
936936

937937
writer!(FunctionShading: |obj| Self { dict: obj.dict() });
938938

939-
impl<'a> FunctionShading<'a> {
939+
impl FunctionShading<'_> {
940940
/// Write the `/ShadingType` attribute.
941941
///
942942
/// Sets the type of shading. The available and required attributes change

src/content.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ pub struct Resources<'a> {
11561156

11571157
writer!(Resources: |obj| Self { dict: obj.dict() });
11581158

1159-
impl<'a> Resources<'a> {
1159+
impl Resources<'_> {
11601160
/// Start writing the `/XObject` dictionary.
11611161
///
11621162
/// Relevant types:
@@ -1292,7 +1292,7 @@ writer!(ExtGraphicsState: |obj| {
12921292
Self { dict }
12931293
});
12941294

1295-
impl<'a> ExtGraphicsState<'a> {
1295+
impl ExtGraphicsState<'_> {
12961296
/// Write the `LW` attribute to set the line width. PDF 1.3+.
12971297
pub fn line_width(&mut self, width: f32) -> &mut Self {
12981298
self.pair(Name(b"LW"), width);
@@ -1586,7 +1586,7 @@ writer!(SoftMask: |obj| {
15861586
Self { dict }
15871587
});
15881588

1589-
impl<'a> SoftMask<'a> {
1589+
impl SoftMask<'_> {
15901590
/// Write the `S` attribute to set the soft mask subtype. Required.
15911591
pub fn subtype(&mut self, subtype: MaskType) -> &mut Self {
15921592
self.pair(Name(b"S"), subtype.to_name());

src/files.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ writer!(FileSpec: |obj| {
1414
Self { dict }
1515
});
1616

17-
impl<'a> FileSpec<'a> {
17+
impl FileSpec<'_> {
1818
/// Write the `/FS` attribute to set the file system this entry relates to.
1919
/// If you set the `system` argument to `Name(b"URL")`, this becomes an URL
2020
/// specification.
@@ -129,7 +129,7 @@ pub struct EmbeddingParams<'a> {
129129

130130
writer!(EmbeddingParams: |obj| Self { dict: obj.dict() });
131131

132-
impl<'a> EmbeddingParams<'a> {
132+
impl EmbeddingParams<'_> {
133133
/// Write the `/Size` attribute to set the uncompressed file size in bytes.
134134
pub fn size(&mut self, size: i32) -> &mut Self {
135135
self.pair(Name(b"Size"), size);

src/font.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ writer!(Type1Font: |obj| {
1616
Self { dict }
1717
});
1818

19-
impl<'a> Type1Font<'a> {
19+
impl Type1Font<'_> {
2020
/// Write the `/Name` attribute, which is the name of the font in the
2121
/// current resource dictionary. Required in PDF 1.0, discouraged in PDF
2222
/// 1.1+.
@@ -103,7 +103,7 @@ writer!(Type3Font: |obj| {
103103
Self { dict }
104104
});
105105

106-
impl<'a> Type3Font<'a> {
106+
impl Type3Font<'_> {
107107
/// Write the `/Name` attribute, which is the name of the font in the
108108
/// current resource dictionary. Always required in PDF 1.0, required if
109109
/// `FontName` is set in child font descriptor.
@@ -209,7 +209,7 @@ writer!(Encoding: |obj| {
209209
Self { dict }
210210
});
211211

212-
impl<'a> Encoding<'a> {
212+
impl Encoding<'_> {
213213
/// Write the `BaseEncoding` attribute, from which this encoding is
214214
/// described through differences.
215215
pub fn base_encoding(&mut self, name: Name) -> &mut Self {
@@ -234,7 +234,7 @@ pub struct Differences<'a> {
234234

235235
writer!(Differences: |obj| Self { array: obj.array() });
236236

237-
impl<'a> Differences<'a> {
237+
impl Differences<'_> {
238238
/// Maps consecutive character codes starting at `start` to the given glyph
239239
/// names.
240240
pub fn consecutive<'n>(
@@ -266,7 +266,7 @@ writer!(Type0Font: |obj| {
266266
Self { dict }
267267
});
268268

269-
impl<'a> Type0Font<'a> {
269+
impl Type0Font<'_> {
270270
/// Write the `/BaseFont` attribute. This is the PostScript name of the
271271
/// font. Required.
272272
pub fn base_font(&mut self, name: Name) -> &mut Self {
@@ -320,7 +320,7 @@ writer!(CidFont: |obj| {
320320
Self { dict }
321321
});
322322

323-
impl<'a> CidFont<'a> {
323+
impl CidFont<'_> {
324324
/// Write the `/Subtype` attribute. Required.
325325
pub fn subtype(&mut self, subtype: CidFontType) -> &mut Self {
326326
self.pair(Name(b"Subtype"), subtype.to_name());
@@ -405,7 +405,7 @@ pub struct Widths<'a> {
405405

406406
writer!(Widths: |obj| Self { array: obj.array() });
407407

408-
impl<'a> Widths<'a> {
408+
impl Widths<'_> {
409409
/// Specifies individual widths for a range of consecutive CIDs starting at
410410
/// `start`.
411411
pub fn consecutive(
@@ -442,7 +442,7 @@ writer!(FontDescriptor: |obj| {
442442
Self { dict }
443443
});
444444

445-
impl<'a> FontDescriptor<'a> {
445+
impl FontDescriptor<'_> {
446446
/// Write the `/FontName` attribute. Required, except for Type 3 fonts.
447447
pub fn name(&mut self, name: Name) -> &mut Self {
448448
self.pair(Name(b"FontName"), name);

src/forms.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub struct Form<'a> {
1010

1111
writer!(Form: |obj| Self { dict: obj.dict() });
1212

13-
impl<'a> Form<'a> {
13+
impl Form<'_> {
1414
/// Write the `/Fields` attribute to reference the root [form fields](Field)
1515
/// (those who have no immediate parent) of this document.
1616
pub fn fields(&mut self, fields: impl IntoIterator<Item = Ref>) -> &mut Self {
@@ -203,7 +203,7 @@ impl FieldType {
203203
}
204204

205205
/// Only permissible on button fields.
206-
impl<'a> Field<'a> {
206+
impl Field<'_> {
207207
/// Write the `/Opt` array to set the export values of children of this
208208
/// field. Only permissible on checkbox fields, or radio button fields.
209209
/// PDF 1.4+.
@@ -217,7 +217,7 @@ impl<'a> Field<'a> {
217217
}
218218

219219
/// Only permissible on check box fields.
220-
impl<'a> Field<'a> {
220+
impl Field<'_> {
221221
/// Write the `/V` attribute to set the state of this check box field. The
222222
/// state corresponds to an appearance stream in the [appearance
223223
/// dictionary](AppearanceCharacteristics) of this field's widget
@@ -255,7 +255,7 @@ impl CheckBoxState {
255255
}
256256

257257
/// Only permissible on radio button fields.
258-
impl<'a> Field<'a> {
258+
impl Field<'_> {
259259
/// Write the `/V` attribute to set the state of this radio button field.
260260
/// The state corresponds to an appearance stream in the
261261
/// [appearance subdictionary](Appearance) of this field's widget
@@ -278,7 +278,7 @@ impl<'a> Field<'a> {
278278
}
279279

280280
/// Only permissible on text fields.
281-
impl<'a> Field<'a> {
281+
impl Field<'_> {
282282
/// Write the `/MaxLen` attribute to set the maximum length of the fields
283283
/// text in characters. Only permissible on text fields.
284284
///
@@ -305,7 +305,7 @@ impl<'a> Field<'a> {
305305
}
306306

307307
/// Only permissible on fields containing variable text.
308-
impl<'a> Field<'a> {
308+
impl Field<'_> {
309309
/// Write the `/DA` attribute containing a sequence of valid page-content
310310
/// graphics or text state operators that define such properties as the
311311
/// field's text size and colour. Only permissible on fields containing
@@ -350,7 +350,7 @@ pub enum Quadding {
350350
}
351351

352352
/// Only permissible on choice fields.
353-
impl<'a> Field<'a> {
353+
impl Field<'_> {
354354
/// Start writing the `/Opt` array to set the options that shall be
355355
/// presented to the user.
356356
pub fn choice_options(&mut self) -> ChoiceOptions<'_> {
@@ -440,7 +440,7 @@ pub struct ChoiceOptions<'a> {
440440

441441
writer!(ChoiceOptions: |obj| Self { array: obj.array() });
442442

443-
impl<'a> ChoiceOptions<'a> {
443+
impl ChoiceOptions<'_> {
444444
/// Add an option with the given value.
445445
pub fn option(&mut self, value: TextStr) -> &mut Self {
446446
self.array.item(value);

src/functions.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ writer!(ExponentialFunction: |obj| {
138138
Self { dict }
139139
});
140140

141-
impl<'a> ExponentialFunction<'a> {
141+
impl ExponentialFunction<'_> {
142142
common_func_methods!();
143143

144144
/// Write the `/C0` array.
@@ -185,7 +185,7 @@ writer!(StitchingFunction: |obj| {
185185
Self { dict }
186186
});
187187

188-
impl<'a> StitchingFunction<'a> {
188+
impl StitchingFunction<'_> {
189189
common_func_methods!();
190190

191191
/// Write the `/Functions` array.
@@ -333,7 +333,7 @@ pub enum PostScriptOp<'a> {
333333
Roll,
334334
}
335335

336-
impl<'a> PostScriptOp<'a> {
336+
impl PostScriptOp<'_> {
337337
/// Encode a slice of operations into a byte stream.
338338
pub fn encode(ops: &[Self]) -> Vec<u8> {
339339
let mut buf = Vec::new();

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ mod tests {
503503
#[test]
504504
fn test_binary_marker() {
505505
let mut w = Pdf::new();
506-
w.set_binary_marker(&[b'A', b'B', b'C', b'D']);
506+
w.set_binary_marker(b"ABCD");
507507
test!(
508508
w.finish(),
509509
b"%PDF-1.7\n%ABCD\n",

0 commit comments

Comments
 (0)