Cargo clippy

This commit is contained in:
topecongiro 2018-02-23 09:07:35 +09:00
parent f09480432d
commit 8531d70c77
4 changed files with 7 additions and 7 deletions

View file

@ -1066,7 +1066,7 @@ impl<'a> Rewrite for ControlFlow<'a> {
debug!("ControlFlow::rewrite {:?} {:?}", self, shape);
let alt_block_sep = &shape.indent.to_string_with_newline(context.config);
let (cond_str, used_width) = self.rewrite_cond(context, shape, &alt_block_sep)?;
let (cond_str, used_width) = self.rewrite_cond(context, shape, alt_block_sep)?;
// If `used_width` is 0, it indicates that whole control flow is written in a single line.
if used_width == 0 {
return Some(cond_str);
@ -1273,10 +1273,10 @@ fn rewrite_match(
let cond_str = cond.rewrite(context, cond_shape)?;
let alt_block_sep = &shape.indent.to_string_with_newline(context.config);
let block_sep = match context.config.control_brace_style() {
ControlBraceStyle::AlwaysNextLine => &alt_block_sep,
ControlBraceStyle::AlwaysNextLine => alt_block_sep,
_ if last_line_extendable(&cond_str) => " ",
// 2 = ` {`
_ if cond_str.contains('\n') || cond_str.len() + 2 > cond_shape.width => &alt_block_sep,
_ if cond_str.contains('\n') || cond_str.len() + 2 > cond_shape.width => alt_block_sep,
_ => " ",
};

View file

@ -78,7 +78,7 @@ mod types;
mod vertical;
pub mod visitor;
const STDIN: &'static str = "<stdin>";
const STDIN: &str = "<stdin>";
// A map of the files of a crate, with their new content
pub type FileMap = Vec<FileRecord>;
@ -753,7 +753,7 @@ pub struct ModifiedLines {
pub chunks: Vec<ModifiedChunk>,
}
/// The successful result of formatting via get_modified_lines().
/// The successful result of formatting via `get_modified_lines()`.
pub struct ModifiedLinesResult {
/// The high level summary details
pub summary: Summary,

View file

@ -299,7 +299,7 @@ pub fn rewrite_macro_def(
span: Span,
) -> Option<String> {
let snippet = Some(remove_trailing_white_spaces(context.snippet(span)));
if snippet.as_ref().map_or(true, |s| s.ends_with(";")) {
if snippet.as_ref().map_or(true, |s| s.ends_with(';')) {
return snippet;
}

View file

@ -706,7 +706,7 @@ impl ConfigCodeBlock {
let fmt_skip = self.code_block
.as_ref()
.unwrap()
.split("\n")
.split('\n')
.nth(0)
.unwrap_or("") == "#![rustfmt_skip]";