Skip to content

Commit 8531d70

Browse files
committed
Cargo clippy
1 parent f094804 commit 8531d70

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

rustfmt-core/src/expr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ impl<'a> Rewrite for ControlFlow<'a> {
10661066
debug!("ControlFlow::rewrite {:?} {:?}", self, shape);
10671067

10681068
let alt_block_sep = &shape.indent.to_string_with_newline(context.config);
1069-
let (cond_str, used_width) = self.rewrite_cond(context, shape, &alt_block_sep)?;
1069+
let (cond_str, used_width) = self.rewrite_cond(context, shape, alt_block_sep)?;
10701070
// If `used_width` is 0, it indicates that whole control flow is written in a single line.
10711071
if used_width == 0 {
10721072
return Some(cond_str);
@@ -1273,10 +1273,10 @@ fn rewrite_match(
12731273
let cond_str = cond.rewrite(context, cond_shape)?;
12741274
let alt_block_sep = &shape.indent.to_string_with_newline(context.config);
12751275
let block_sep = match context.config.control_brace_style() {
1276-
ControlBraceStyle::AlwaysNextLine => &alt_block_sep,
1276+
ControlBraceStyle::AlwaysNextLine => alt_block_sep,
12771277
_ if last_line_extendable(&cond_str) => " ",
12781278
// 2 = ` {`
1279-
_ if cond_str.contains('\n') || cond_str.len() + 2 > cond_shape.width => &alt_block_sep,
1279+
_ if cond_str.contains('\n') || cond_str.len() + 2 > cond_shape.width => alt_block_sep,
12801280
_ => " ",
12811281
};
12821282

rustfmt-core/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ mod types;
7878
mod vertical;
7979
pub mod visitor;
8080

81-
const STDIN: &'static str = "<stdin>";
81+
const STDIN: &str = "<stdin>";
8282

8383
// A map of the files of a crate, with their new content
8484
pub type FileMap = Vec<FileRecord>;
@@ -753,7 +753,7 @@ pub struct ModifiedLines {
753753
pub chunks: Vec<ModifiedChunk>,
754754
}
755755

756-
/// The successful result of formatting via get_modified_lines().
756+
/// The successful result of formatting via `get_modified_lines()`.
757757
pub struct ModifiedLinesResult {
758758
/// The high level summary details
759759
pub summary: Summary,

rustfmt-core/src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ pub fn rewrite_macro_def(
299299
span: Span,
300300
) -> Option<String> {
301301
let snippet = Some(remove_trailing_white_spaces(context.snippet(span)));
302-
if snippet.as_ref().map_or(true, |s| s.ends_with(";")) {
302+
if snippet.as_ref().map_or(true, |s| s.ends_with(';')) {
303303
return snippet;
304304
}
305305

rustfmt-core/tests/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ impl ConfigCodeBlock {
706706
let fmt_skip = self.code_block
707707
.as_ref()
708708
.unwrap()
709-
.split("\n")
709+
.split('\n')
710710
.nth(0)
711711
.unwrap_or("") == "#![rustfmt_skip]";
712712

0 commit comments

Comments
 (0)