Skip to content

Commit

Permalink
Merge branch 'main' into key-lifecycle
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip-NLnetLabs committed Nov 29, 2024
2 parents ec119af + 93a0053 commit 5a1bd6c
Show file tree
Hide file tree
Showing 45 changed files with 120 additions and 97 deletions.
17 changes: 8 additions & 9 deletions src/base/charstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ impl<'a> Iter<'a> {
}
}

impl<'a> Iterator for Iter<'a> {
impl Iterator for Iter<'_> {
type Item = u8;

fn next(&mut self) -> Option<Self::Item> {
Expand All @@ -929,7 +929,7 @@ impl<'a> Iterator for Iter<'a> {
#[derive(Clone, Copy, Debug)]
pub struct DisplayQuoted<'a>(&'a CharStr<[u8]>);

impl<'a> fmt::Display for DisplayQuoted<'a> {
impl fmt::Display for DisplayQuoted<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("\"")?;
for &ch in self.0.as_ref() {
Expand All @@ -947,7 +947,7 @@ impl<'a> fmt::Display for DisplayQuoted<'a> {
#[derive(Clone, Copy, Debug)]
pub struct DisplayUnquoted<'a>(&'a CharStr<[u8]>);

impl<'a> fmt::Display for DisplayUnquoted<'a> {
impl fmt::Display for DisplayUnquoted<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for &ch in self.0.as_ref() {
fmt::Display::fmt(&Symbol::from_octet(ch), f)?;
Expand Down Expand Up @@ -978,8 +978,8 @@ impl<'a, Builder> DeserializeCharStrSeed<'a, Builder> {
}

#[cfg(feature = "serde")]
impl<'de, 'a, Builder> serde::de::DeserializeSeed<'de>
for DeserializeCharStrSeed<'a, Builder>
impl<'de, Builder> serde::de::DeserializeSeed<'de>
for DeserializeCharStrSeed<'_, Builder>
where
Builder: OctetsBuilder + AsMut<[u8]>,
{
Expand All @@ -1000,7 +1000,7 @@ where
DeserializeCharStrSeed<'a, Builder>,
);

impl<'de, 'a, Builder> serde::de::Visitor<'de> for NewtypeVisitor<'a, Builder>
impl<'de, Builder> serde::de::Visitor<'de> for NewtypeVisitor<'_, Builder>
where
Builder: OctetsBuilder + AsMut<[u8]>,
{
Expand All @@ -1027,8 +1027,7 @@ where
DeserializeCharStrSeed<'a, Builder>,
);

impl<'de, 'a, Builder> serde::de::Visitor<'de>
for ReadableVisitor<'a, Builder>
impl<Builder> serde::de::Visitor<'_> for ReadableVisitor<'_, Builder>
where
Builder: OctetsBuilder + AsMut<[u8]>,
{
Expand Down Expand Up @@ -1065,7 +1064,7 @@ where
DeserializeCharStrSeed<'a, Builder>,
);

impl<'de, 'a, Builder> serde::de::Visitor<'de> for BinaryVisitor<'a, Builder>
impl<Builder> serde::de::Visitor<'_> for BinaryVisitor<'_, Builder>
where
Builder: OctetsBuilder,
{
Expand Down
2 changes: 1 addition & 1 deletion src/base/dig_printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub(super) struct DigPrinter<'a, Octs> {
pub msg: &'a Message<Octs>,
}

impl<'a, Octs: AsRef<[u8]>> fmt::Display for DigPrinter<'a, Octs> {
impl<Octs: AsRef<[u8]>> fmt::Display for DigPrinter<'_, Octs> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let msg = self.msg.for_slice_ref();

Expand Down
16 changes: 8 additions & 8 deletions src/base/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,13 +819,13 @@ impl<'a, Octs: Octets + ?Sized> QuestionSection<'a, Octs> {

//--- Clone and Clone

impl<'a, Octs: ?Sized> Clone for QuestionSection<'a, Octs> {
impl<Octs: ?Sized> Clone for QuestionSection<'_, Octs> {
fn clone(&self) -> Self {
*self
}
}

impl<'a, Octs: ?Sized> Copy for QuestionSection<'a, Octs> {}
impl<Octs: ?Sized> Copy for QuestionSection<'_, Octs> {}

//--- Iterator

Expand All @@ -852,8 +852,8 @@ impl<'a, Octs: Octets + ?Sized> Iterator for QuestionSection<'a, Octs> {

//--- PartialEq

impl<'a, 'o, Octs, Other> PartialEq<QuestionSection<'o, Other>>
for QuestionSection<'a, Octs>
impl<'o, Octs, Other> PartialEq<QuestionSection<'o, Other>>
for QuestionSection<'_, Octs>
where
Octs: Octets + ?Sized,
Other: Octets + ?Sized,
Expand Down Expand Up @@ -1056,13 +1056,13 @@ impl<'a, Octs: Octets + ?Sized> RecordSection<'a, Octs> {

//--- Clone and Copy

impl<'a, Octs: ?Sized> Clone for RecordSection<'a, Octs> {
impl<Octs: ?Sized> Clone for RecordSection<'_, Octs> {
fn clone(&self) -> Self {
*self
}
}

impl<'a, Octs: ?Sized> Copy for RecordSection<'a, Octs> {}
impl<Octs: ?Sized> Copy for RecordSection<'_, Octs> {}

//--- Iterator

Expand Down Expand Up @@ -1182,7 +1182,7 @@ where

//--- Clone

impl<'a, Octs: ?Sized, Data> Clone for RecordIter<'a, Octs, Data> {
impl<Octs: ?Sized, Data> Clone for RecordIter<'_, Octs, Data> {
fn clone(&self) -> Self {
RecordIter {
section: self.section,
Expand Down Expand Up @@ -1273,7 +1273,7 @@ where

//--- Clone

impl<'a, Octs: ?Sized, Data> Clone for AnyRecordIter<'a, Octs, Data> {
impl<Octs: ?Sized, Data> Clone for AnyRecordIter<'_, Octs, Data> {
fn clone(&self) -> Self {
Self {
section: self.section,
Expand Down
5 changes: 4 additions & 1 deletion src/base/name/absolute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,10 @@ impl<Octs> ToLabelIter for Name<Octs>
where
Octs: AsRef<[u8]> + ?Sized,
{
type LabelIter<'a> = NameIter<'a> where Octs: 'a;
type LabelIter<'a>
= NameIter<'a>
where
Octs: 'a;

fn iter_labels(&self) -> Self::LabelIter<'_> {
self.iter()
Expand Down
23 changes: 15 additions & 8 deletions src/base/name/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ impl<L, R> Chain<L, R> {
//--- ToLabelIter, ToRelativeName, ToName

impl<L: ToRelativeName, R: ToLabelIter> ToLabelIter for Chain<L, R> {
type LabelIter<'a> = ChainIter<'a, L, R> where L: 'a, R: 'a;
type LabelIter<'a>
= ChainIter<'a, L, R>
where
L: 'a,
R: 'a;

fn iter_labels(&self) -> Self::LabelIter<'_> {
ChainIter(self.left.iter_labels().chain(self.right.iter_labels()))
Expand All @@ -145,8 +149,11 @@ where
Octs: AsRef<[u8]>,
R: ToName,
{
type LabelIter<'a> = UncertainChainIter<'a, Octs, R>
where Octs: 'a, R: 'a;
type LabelIter<'a>
= UncertainChainIter<'a, Octs, R>
where
Octs: 'a,
R: 'a;

fn iter_labels(&self) -> Self::LabelIter<'_> {
match self.left {
Expand Down Expand Up @@ -241,7 +248,7 @@ pub struct ChainIter<'a, L: ToLabelIter + 'a, R: ToLabelIter + 'a>(
iter::Chain<L::LabelIter<'a>, R::LabelIter<'a>>,
);

impl<'a, L, R> Clone for ChainIter<'a, L, R>
impl<L, R> Clone for ChainIter<'_, L, R>
where
L: ToLabelIter,
R: ToLabelIter,
Expand All @@ -263,7 +270,7 @@ where
}
}

impl<'a, L, R> DoubleEndedIterator for ChainIter<'a, L, R>
impl<L, R> DoubleEndedIterator for ChainIter<'_, L, R>
where
L: ToLabelIter,
R: ToLabelIter,
Expand All @@ -281,7 +288,7 @@ pub enum UncertainChainIter<'a, Octets: AsRef<[u8]>, R: ToLabelIter> {
Relative(ChainIter<'a, UncertainName<Octets>, R>),
}

impl<'a, Octets, R> Clone for UncertainChainIter<'a, Octets, R>
impl<Octets, R> Clone for UncertainChainIter<'_, Octets, R>
where
Octets: AsRef<[u8]>,
R: ToLabelIter,
Expand Down Expand Up @@ -311,7 +318,7 @@ where
}
}

impl<'a, Octets, R> DoubleEndedIterator for UncertainChainIter<'a, Octets, R>
impl<Octets, R> DoubleEndedIterator for UncertainChainIter<'_, Octets, R>
where
Octets: AsRef<[u8]>,
R: ToLabelIter,
Expand All @@ -328,7 +335,7 @@ where

struct DisplayWithDot<'a, L, R>(&'a Chain<L, R>);

impl<'a, L, R> fmt::Display for DisplayWithDot<'a, L, R>
impl<L, R> fmt::Display for DisplayWithDot<'_, L, R>
where
Chain<L, R>: ToLabelIter,
{
Expand Down
5 changes: 4 additions & 1 deletion src/base/name/parsed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,10 @@ impl<Octs: AsRef<[u8]>> hash::Hash for ParsedName<Octs> {
//--- ToLabelIter and ToName

impl<Octs: AsRef<[u8]>> ToLabelIter for ParsedName<Octs> {
type LabelIter<'s> = ParsedNameIter<'s> where Octs: 's;
type LabelIter<'s>
= ParsedNameIter<'s>
where
Octs: 's;

fn iter_labels(&self) -> Self::LabelIter<'_> {
self.iter()
Expand Down
7 changes: 5 additions & 2 deletions src/base/name/relative.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,10 @@ impl<Octs> ToLabelIter for RelativeName<Octs>
where
Octs: AsRef<[u8]> + ?Sized,
{
type LabelIter<'a> = NameIter<'a> where Octs: 'a;
type LabelIter<'a>
= NameIter<'a>
where
Octs: 'a;

fn iter_labels(&self) -> Self::LabelIter<'_> {
self.iter()
Expand Down Expand Up @@ -926,7 +929,7 @@ impl<'a> Iterator for NameIter<'a> {
}
}

impl<'a> DoubleEndedIterator for NameIter<'a> {
impl DoubleEndedIterator for NameIter<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
if self.slice.is_empty() {
return None;
Expand Down
8 changes: 6 additions & 2 deletions src/base/name/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ pub trait ToLabelIter {
}

impl<'r, N: ToLabelIter + ?Sized> ToLabelIter for &'r N {
type LabelIter<'a> = N::LabelIter<'a> where 'r: 'a, N: 'a;
type LabelIter<'a>
= N::LabelIter<'a>
where
'r: 'a,
N: 'a;

fn iter_labels(&self) -> Self::LabelIter<'_> {
(*self).iter_labels()
Expand Down Expand Up @@ -351,7 +355,7 @@ pub trait ToName: ToLabelIter {

pub struct DisplayWithDot<'a, T: ?Sized>(&'a T);

impl<'a, T> fmt::Display for DisplayWithDot<'a, T>
impl<T> fmt::Display for DisplayWithDot<'_, T>
where
T: ToLabelIter + ?Sized,
{
Expand Down
5 changes: 4 additions & 1 deletion src/base/name/uncertain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,10 @@ impl<Octets: AsRef<[u8]>> hash::Hash for UncertainName<Octets> {
//--- ToLabelIter

impl<Octs: AsRef<[u8]>> ToLabelIter for UncertainName<Octs> {
type LabelIter<'a> = NameIter<'a> where Octs: 'a;
type LabelIter<'a>
= NameIter<'a>
where
Octs: 'a;

fn iter_labels(&self) -> Self::LabelIter<'_> {
match *self {
Expand Down
4 changes: 2 additions & 2 deletions src/base/opt/algsig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ impl<Octs: Octets> Opt<Octs> {
}
}

impl<'a, Target: Composer> OptBuilder<'a, Target> {
impl<Target: Composer> OptBuilder<'_, Target> {
/// Appends a DAU option.
///
/// The DAU option lists the DNSSEC signature algorithms the requester
Expand Down Expand Up @@ -538,7 +538,7 @@ impl<'a> SecAlgsIter<'a> {
}
}

impl<'a> Iterator for SecAlgsIter<'a> {
impl Iterator for SecAlgsIter<'_> {
type Item = SecAlg;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion src/base/opt/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ impl<Octs: Octets> Opt<Octs> {
}
}

impl<'a, Target: Composer> OptBuilder<'a, Target> {
impl<Target: Composer> OptBuilder<'_, Target> {
/// Appends the CHAIN option.
///
/// The CHAIN option allows a client to request that all records that
Expand Down
2 changes: 1 addition & 1 deletion src/base/opt/cookie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl<Octs: Octets> Opt<Octs> {
}
}

impl<'a, Target: Composer> OptBuilder<'a, Target> {
impl<Target: Composer> OptBuilder<'_, Target> {
/// Appends a new cookie option.
pub fn cookie(
&mut self, cookie: Cookie,
Expand Down
2 changes: 1 addition & 1 deletion src/base/opt/expire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl<Octs: Octets> Opt<Octs> {
}
}

impl<'a, Target: Composer> OptBuilder<'a, Target> {
impl<Target: Composer> OptBuilder<'_, Target> {
/// Appends the Expire option.
///
/// The Expire option allows an authoritative server to signal its own
Expand Down
2 changes: 1 addition & 1 deletion src/base/opt/exterr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ impl<Octs: Octets> Opt<Octs> {
}
}

impl<'a, Target: Composer> OptBuilder<'a, Target> {
impl<Target: Composer> OptBuilder<'_, Target> {
/// Appends an extended DNS error option.
///
/// The extended DNS error option carries additional error information in
Expand Down
2 changes: 1 addition & 1 deletion src/base/opt/keepalive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl<Octs: Octets> Opt<Octs> {
}
}

impl<'a, Target: Composer> OptBuilder<'a, Target> {
impl<Target: Composer> OptBuilder<'_, Target> {
pub fn tcp_keepalive(
&mut self, timeout: Option<IdleTimeout>
) -> Result<(), Target::AppendError> {
Expand Down
4 changes: 2 additions & 2 deletions src/base/opt/keytag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ impl<Octs: Octets> Opt<Octs> {
}
}

impl<'a, Target: Composer> OptBuilder<'a, Target> {
impl<Target: Composer> OptBuilder<'_, Target> {
/// Appends a edns-key-tag option.
///
/// The option contains a list of the key tags of the trust anchor keys
Expand Down Expand Up @@ -363,7 +363,7 @@ impl<Octs: AsRef<[u8]>> serde::Serialize for KeyTag<Octs> {
#[derive(Clone, Copy, Debug)]
pub struct KeyTagIter<'a>(&'a [u8]);

impl<'a> Iterator for KeyTagIter<'a> {
impl Iterator for KeyTagIter<'_> {
type Item = u16;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion src/base/opt/nsid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ impl<Octs: Octets> Opt<Octs> {
}
}

impl<'a, Target: Composer> OptBuilder<'a, Target> {
impl<Target: Composer> OptBuilder<'_, Target> {
/// Appends an NSID option with the given server identifier.
///
/// The NSID option contains an identifier for the name server that
Expand Down
2 changes: 1 addition & 1 deletion src/base/opt/padding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl<Octs: AsRef<[u8]> + ?Sized> fmt::Debug for Padding<Octs> {

//--- Extended OptBuilder

impl<'a, Target: Composer> OptBuilder<'a, Target> {
impl<Target: Composer> OptBuilder<'_, Target> {
pub fn padding( &mut self, len: u16) -> Result<(), Target::AppendError> {
self.push_raw_option(
OptionCode::PADDING,
Expand Down
2 changes: 1 addition & 1 deletion src/base/opt/subnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ impl<Octs: Octets> Opt<Octs> {
}
}

impl<'a, Target: Composer> OptBuilder<'a, Target> {
impl<Target: Composer> OptBuilder<'_, Target> {
pub fn client_subnet(
&mut self,
source_prefix_len: u8,
Expand Down
Loading

0 comments on commit 5a1bd6c

Please sign in to comment.