Skip to content

Commit d3eba76

Browse files
committed
update Serde, etc.
Lots of changes to how closures work
1 parent 61ab06a commit d3eba76

19 files changed

+352
-306
lines changed

Cargo.lock

Lines changed: 32 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ regex = "0.1"
2222
term = "0.4"
2323
strings = "0.0.1"
2424
diff = "0.1"
25-
syntex_syntax = "0.44"
26-
syntex_errors = "0.44"
25+
syntex_syntax = "0.50"
26+
syntex_errors = "0.50"
2727
log = "0.3"
2828
env_logger = "0.3"
2929
getopts = "0.2"

src/bin/cargo-fmt.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,8 @@ fn format_crate(verbosity: Verbosity) -> Result<ExitStatus, std::io::Error> {
9898
// Currently only bin and lib files get formatted
9999
let files: Vec<_> = targets.into_iter()
100100
.filter(|t| t.kind.should_format())
101-
.inspect(|t| {
102-
if verbosity == Verbosity::Verbose {
103-
println!("[{:?}] {:?}", t.kind, t.path)
104-
}
101+
.inspect(|t| if verbosity == Verbosity::Verbose {
102+
println!("[{:?}] {:?}", t.kind, t.path)
105103
})
106104
.map(|t| t.path)
107105
.collect();
@@ -204,15 +202,12 @@ fn format_files(files: &[PathBuf],
204202
.args(files)
205203
.args(fmt_args)
206204
.spawn()
207-
.map_err(|e| {
208-
match e.kind() {
209-
std::io::ErrorKind::NotFound => {
210-
std::io::Error::new(std::io::ErrorKind::Other,
211-
"Could not run rustfmt, please make sure it is in your \
212-
PATH.")
213-
}
214-
_ => e,
205+
.map_err(|e| match e.kind() {
206+
std::io::ErrorKind::NotFound => {
207+
std::io::Error::new(std::io::ErrorKind::Other,
208+
"Could not run rustfmt, please make sure it is in your PATH.")
215209
}
210+
_ => e,
216211
}));
217212
command.wait()
218213
}

src/codemap.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,13 @@ pub trait LineRangeUtils {
4646
}
4747

4848
impl SpanUtils for CodeMap {
49-
#[inline]
5049
fn span_after(&self, original: Span, needle: &str) -> BytePos {
5150
let snippet = self.span_to_snippet(original).unwrap();
5251
let offset = snippet.find_uncommented(needle).unwrap() + needle.len();
5352

5453
original.lo + BytePos(offset as u32)
5554
}
5655

57-
#[inline]
5856
fn span_after_last(&self, original: Span, needle: &str) -> BytePos {
5957
let snippet = self.span_to_snippet(original).unwrap();
6058
let mut offset = 0;
@@ -66,7 +64,6 @@ impl SpanUtils for CodeMap {
6664
original.lo + BytePos(offset as u32)
6765
}
6866

69-
#[inline]
7067
fn span_before(&self, original: Span, needle: &str) -> BytePos {
7168
let snippet = self.span_to_snippet(original).unwrap();
7269
let offset = snippet.find_uncommented(needle).unwrap();

src/comment.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,10 @@ pub fn rewrite_comment(orig: &str,
111111
line.trim_right()
112112
})
113113
.map(left_trim_comment_line)
114-
.map(|line| {
115-
if orig.starts_with("/*") && line_breaks == 0 {
116-
line.trim_left()
117-
} else {
118-
line
119-
}
114+
.map(|line| if orig.starts_with("/*") && line_breaks == 0 {
115+
line.trim_left()
116+
} else {
117+
line
120118
});
121119

122120
let mut result = opener.to_owned();
@@ -746,11 +744,9 @@ mod test {
746744
// keeping it around unless it helps us test stuff.
747745
fn uncommented(text: &str) -> String {
748746
CharClasses::new(text.chars())
749-
.filter_map(|(s, c)| {
750-
match s {
751-
FullCodeCharKind::Normal => Some(c),
752-
_ => None,
753-
}
747+
.filter_map(|(s, c)| match s {
748+
FullCodeCharKind::Normal => Some(c),
749+
_ => None,
754750
})
755751
.collect()
756752
}

0 commit comments

Comments
 (0)