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);
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,
_ => " ",
};
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>;
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,
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;
}