Skip to content

Commit dc8c517

Browse files
committed
avoid wrapping and unwrapping MaybeSpanned
1 parent 809d586 commit dc8c517

File tree

3 files changed

+3
-16
lines changed

3 files changed

+3
-16
lines changed

src/lib.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -878,13 +878,7 @@ fn run_rustfix(
878878
stdout: stdout.into(),
879879
})?;
880880

881-
let edition = comments.edition(revision, &config.comment_defaults)?;
882-
let edition = edition
883-
.map(|mwl| {
884-
let line = mwl.span().unwrap_or_default();
885-
Spanned::new(mwl.into_inner(), line)
886-
})
887-
.into();
881+
let edition = comments.edition(revision, &config.comment_defaults)?.into();
888882
let rustfix_comments = Comments {
889883
revisions: None,
890884
revisioned: std::iter::once((

src/parser.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,12 @@ impl Comments {
9292
&self,
9393
revision: &str,
9494
default: &Self,
95-
) -> Result<Option<MaybeSpanned<String>>, Errored> {
95+
) -> Result<Option<Spanned<String>>, Errored> {
9696
let edition =
9797
self.find_one_for_revision(revision, "`edition` annotations", |r| r.edition.clone())?;
9898
let default = default
9999
.find_one_for_revision(revision, "`edition` annotations", |r| r.edition.clone())?;
100-
let edition = edition
101-
.into_inner()
102-
.or(default.into_inner())
103-
.map(MaybeSpanned::from);
100+
let edition = edition.into_inner().or(default.into_inner());
104101
Ok(edition)
105102
}
106103

src/parser/spanned.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ impl<T> MaybeSpanned<T> {
2323
pub fn span(&self) -> Option<Span> {
2424
self.span.clone()
2525
}
26-
27-
pub fn into_inner(self) -> T {
28-
self.data
29-
}
3026
}
3127

3228
impl<T> From<Spanned<T>> for MaybeSpanned<T> {

0 commit comments

Comments
 (0)