Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
daniel.eades
arti
Commits
27cca719
Commit
27cca719
authored
Sep 11, 2021
by
daniel.eades
Browse files
derive 'Default' where possible
parent
1c08bb44
Pipeline
#12647
passed with stage
in 11 minutes and 11 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
crates/tor-netdoc/src/doc/microdesc.rs
View file @
27cca719
...
...
@@ -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.
...
...
crates/tor-netdoc/src/doc/routerdesc.rs
View file @
27cca719
...
...
@@ -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
>
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment