Commit 27cca719 authored by daniel.eades's avatar daniel.eades
Browse files

derive 'Default' where possible

parent 1c08bb44
Pipeline #12647 passed with stage
in 11 minutes and 11 seconds
......@@ -39,7 +39,7 @@ pub use build::MicrodescBuilder;
/// Annotations prepended to a microdescriptor that has been stored to
/// disk.
#[allow(dead_code)]
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub struct MicrodescAnnotation {
/// A time at which this microdescriptor was last listed in some
/// consensus document.
......@@ -193,12 +193,6 @@ static MICRODESC_RULES: Lazy<SectionRules<MicrodescKwd>> = Lazy::new(|| {
rules
});
impl Default for MicrodescAnnotation {
fn default() -> Self {
MicrodescAnnotation { last_listed: None }
}
}
impl MicrodescAnnotation {
/// Extract a (possibly empty) microdescriptor annotation from a
/// reader.
......
......@@ -60,6 +60,7 @@ pub struct AnnotatedRouterDesc {
/// Annotations about a router descriptor, as stored on disc.
#[allow(dead_code)] // don't warn about fields not getting read.
#[derive(Default)]
pub struct RouterAnnotation {
/// Description of where we got this router descriptor
source: Option<String>,
......@@ -284,16 +285,6 @@ static ROUTER_SIG_RULES: Lazy<SectionRules<RouterKwd>> = Lazy::new(|| {
rules
});
impl Default for RouterAnnotation {
fn default() -> Self {
RouterAnnotation {
source: None,
downloaded: None,
purpose: None,
}
}
}
impl RouterAnnotation {
/// Extract a single RouterAnnotation (possibly empty) from a reader.
fn take_from_reader(reader: &mut NetDocReader<'_, RouterKwd>) -> Result<RouterAnnotation> {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment