diff options
| author | Seiichi Uchida <seuchida@gmail.com> | 2018-03-08 16:29:00 +0900 |
|---|---|---|
| committer | Seiichi Uchida <seuchida@gmail.com> | 2018-03-08 18:10:23 +0900 |
| commit | a6b574bfa7a301405b64d54e7576d001fb22b7db (patch) | |
| tree | 0fd305dbd2f0eb7e6f60236796ee9888dc25bd9b /src | |
| parent | a2f861730e5b33391c97fe7ec91470d1c9b96ba9 (diff) | |
Cargo update and cargo clippy
Diffstat (limited to 'src')
| -rw-r--r-- | src/bin/main.rs | 2 | ||||
| -rw-r--r-- | src/expr.rs | 16 | ||||
| -rw-r--r-- | src/format-diff/main.rs | 2 | ||||
| -rw-r--r-- | src/git-rustfmt/main.rs | 2 | ||||
| -rw-r--r-- | src/lib.rs | 8 |
5 files changed, 14 insertions, 16 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs index d58cb50ac68..b9d413bbed0 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -335,7 +335,7 @@ fn execute(opts: &Options) -> FmtResult<Summary> { } fn main() { - let _ = env_logger::init(); + env_logger::init(); let opts = make_opts(); diff --git a/src/expr.rs b/src/expr.rs index 481baa80de6..2cbeaaa584b 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1044,14 +1044,12 @@ impl<'a> ControlFlow<'a> { .span_after(mk_sp(lo, self.span.hi()), self.keyword.trim()), if self.pats.is_empty() { cond_span.lo() + } else if self.matcher.is_empty() { + self.pats[0].span.lo() } else { - if self.matcher.is_empty() { - self.pats[0].span.lo() - } else { - context - .snippet_provider - .span_before(self.span, self.matcher.trim()) - } + context + .snippet_provider + .span_before(self.span, self.matcher.trim()) }, ); @@ -1268,7 +1266,7 @@ pub fn is_unsafe_block(block: &ast::Block) -> bool { } } -/// A simple wrapper type against ast::Arm. Used inside write_list(). +/// A simple wrapper type against `ast::Arm`. Used inside `write_list()`. struct ArmWrapper<'a> { pub arm: &'a ast::Arm, /// True if the arm is the last one in match expression. Used to decide on whether we should add @@ -1787,7 +1785,7 @@ fn rewrite_multiple_patterns( separator: " |", trailing_separator: SeparatorTactic::Never, separator_place: context.config.binop_separator(), - shape: shape, + shape, ends_with_newline: false, preserve_newline: false, config: context.config, diff --git a/src/format-diff/main.rs b/src/format-diff/main.rs index c42fbb6f7cf..6633da208e8 100644 --- a/src/format-diff/main.rs +++ b/src/format-diff/main.rs @@ -81,7 +81,7 @@ impl From<io::Error> for FormatDiffError { } fn main() { - let _ = env_logger::init(); + env_logger::init(); let mut opts = getopts::Options::new(); opts.optflag("h", "help", "show this message"); diff --git a/src/git-rustfmt/main.rs b/src/git-rustfmt/main.rs index 8811c1a5255..41e4ee2931d 100644 --- a/src/git-rustfmt/main.rs +++ b/src/git-rustfmt/main.rs @@ -184,7 +184,7 @@ impl Config { } fn main() { - let _ = env_logger::init(); + env_logger::init(); let opts = make_opts(); let matches = opts.parse(env::args().skip(1)) diff --git a/src/lib.rs b/src/lib.rs index e53f8bfb907..9447155ee92 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -798,7 +798,7 @@ pub fn get_modified_lines( let mut config = config.clone(); config.set().write_mode(config::WriteMode::Modified); - let (summary, filemap, formatreport) = format_input(input, &config, Some(&mut data))?; + let (summary, filemap, report) = format_input(input, &config, Some(&mut data))?; let mut lines = data.lines(); let mut chunks = Vec::new(); @@ -823,9 +823,9 @@ pub fn get_modified_lines( }); } Ok(ModifiedLinesResult { - summary: summary, - filemap: filemap, - report: formatreport, + summary, + filemap, + report, modified_lines: ModifiedLines { chunks }, }) } |
