From 47f3f685ed698400c4a0a2bfd170849f366e49e5 Mon Sep 17 00:00:00 2001 From: Evan Cameron Date: Wed, 20 Jan 2021 16:38:37 -0500 Subject: [PATCH] add mut Edns, deprecate set_option --- crates/proto/src/op/edns.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/crates/proto/src/op/edns.rs b/crates/proto/src/op/edns.rs index 139a8a2232..63b6f7b2a5 100644 --- a/crates/proto/src/op/edns.rs +++ b/crates/proto/src/op/edns.rs @@ -115,14 +115,10 @@ impl Edns { } /// Set the specified EDNS option + #[deprecated(note = "Please use options_mut() to modify")] pub fn set_option(&mut self, option: EdnsOption) { self.options.insert(option); } - - /// Remove the option specified by the `EdnsCode` - pub fn remove_option(&mut self, option: EdnsCode) { - self.options.remove(option); - } } impl<'a> From<&'a Record> for Edns { @@ -236,11 +232,7 @@ fn test_encode_decode() { assert_eq!(edns.rcode_high(), edns_decode.rcode_high()); assert_eq!(edns.options(), edns_decode.options()); - // remove option - edns.remove_option(EdnsCode::DAU); - assert!(edns.option(EdnsCode::DAU).is_none()); - - // re-insert and remove r using mut + // re-insert and remove using mut edns.options_mut() .insert(EdnsOption::DAU(SupportedAlgorithms::all())); edns.options_mut().remove(EdnsCode::DAU);