]> git.lizzy.rs Git - rust.git/commitdiff
Cargo clippy
authortopecongiro <seuchida@gmail.com>
Fri, 23 Feb 2018 00:07:35 +0000 (09:07 +0900)
committertopecongiro <seuchida@gmail.com>
Fri, 23 Feb 2018 00:07:35 +0000 (09:07 +0900)
rustfmt-core/src/expr.rs
rustfmt-core/src/lib.rs
rustfmt-core/src/macros.rs
rustfmt-core/tests/lib.rs

index 1ed85619235b3db33dde0b4f5f72e2f0504716eb..9c5682cc635b84d7fd5178e5309f179eee6c5baf 100644 (file)
@@ -1066,7 +1066,7 @@ fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
         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,
         _ => " ",
     };
 
index b095d06abb816aa7cfdccc19023024b404bb693d..5697d6cab2d36a8bcd93c1c6660b47b49e3f1c62 100644 (file)
@@ -78,7 +78,7 @@
 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,
index 1d40efb9b3a1d92135c974852eed2a36c4b839b0..8228450b510258743704f44a6ea6c540ac64c936 100644 (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;
     }
 
index f0aad73507d0b895c3bf3efdd6feab981dfd5870..f219cf3212b9b0d5065a7bfc01da55075eb32352 100644 (file)
@@ -706,7 +706,7 @@ fn code_block_valid(&self) -> bool {
         let fmt_skip = self.code_block
             .as_ref()
             .unwrap()
-            .split("\n")
+            .split('\n')
             .nth(0)
             .unwrap_or("") == "#![rustfmt_skip]";