Use field init shorthand
diff --git a/src/lib.rs b/src/lib.rs
index 9c44ea7..190916d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -136,7 +136,7 @@
impl TokenStream {
fn _new(inner: imp::TokenStream) -> TokenStream {
TokenStream {
- inner: inner,
+ inner,
_marker: marker::PhantomData,
}
}
@@ -268,7 +268,7 @@
impl SourceFile {
fn _new(inner: imp::SourceFile) -> Self {
SourceFile {
- inner: inner,
+ inner,
_marker: marker::PhantomData,
}
}
@@ -328,7 +328,7 @@
impl Span {
fn _new(inner: imp::Span) -> Span {
Span {
- inner: inner,
+ inner,
_marker: marker::PhantomData,
}
}
@@ -411,10 +411,7 @@
#[cfg(span_locations)]
pub fn start(&self) -> LineColumn {
let imp::LineColumn { line, column } = self.inner.start();
- LineColumn {
- line: line,
- column: column,
- }
+ LineColumn { line, column }
}
/// Get the ending line/column in the source file for this span.
@@ -423,10 +420,7 @@
#[cfg(span_locations)]
pub fn end(&self) -> LineColumn {
let imp::LineColumn { line, column } = self.inner.end();
- LineColumn {
- line: line,
- column: column,
- }
+ LineColumn { line, column }
}
/// Create a new span encompassing `self` and `other`.
@@ -583,7 +577,7 @@
impl Group {
fn _new(inner: imp::Group) -> Self {
- Group { inner: inner }
+ Group { inner }
}
fn _new_stable(inner: fallback::Group) -> Self {
@@ -709,8 +703,8 @@
/// which can be further configured with the `set_span` method below.
pub fn new(op: char, spacing: Spacing) -> Punct {
Punct {
- op: op,
- spacing: spacing,
+ op,
+ spacing,
span: Span::call_site(),
}
}
@@ -831,7 +825,7 @@
impl Ident {
fn _new(inner: imp::Ident) -> Ident {
Ident {
- inner: inner,
+ inner,
_marker: marker::PhantomData,
}
}
@@ -999,7 +993,7 @@
impl Literal {
fn _new(inner: imp::Literal) -> Literal {
Literal {
- inner: inner,
+ inner,
_marker: marker::PhantomData,
}
}