Skip to content

Commit 368e753

Browse files
committed
pem: use ReadIter constructor
1 parent 7435bc4 commit 368e753

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/pem.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ pub trait PemObject: Sized {
5353
fn pem_file_iter(
5454
file_name: impl AsRef<std::path::Path>,
5555
) -> Result<ReadIter<io::BufReader<File>, Self>, Error> {
56-
Ok(ReadIter::<_, Self> {
57-
rd: io::BufReader::new(File::open(file_name).map_err(Error::Io)?),
58-
_ty: PhantomData,
59-
})
56+
Ok(ReadIter::new(io::BufReader::new(
57+
File::open(file_name).map_err(Error::Io)?,
58+
)))
6059
}
6160

6261
/// Decode the first section of this type from PEM read from an [`io::Read`].
@@ -70,10 +69,7 @@ pub trait PemObject: Sized {
7069
/// Iterate over all sections of this type from PEM present in an [`io::Read`].
7170
#[cfg(feature = "std")]
7271
fn pem_reader_iter<R: std::io::Read>(rd: R) -> ReadIter<io::BufReader<R>, Self> {
73-
ReadIter::<_, Self> {
74-
rd: io::BufReader::new(rd),
75-
_ty: PhantomData,
76-
}
72+
ReadIter::new(io::BufReader::new(rd))
7773
}
7874

7975
/// Conversion from a PEM [`SectionKind`] and body data.

0 commit comments

Comments
 (0)