提交 d5f14708 编写于 作者: M Mark Rousskov

De-indent all fmt::Display impls for later replacement to functions

上级 eefaee1a
......@@ -290,11 +290,11 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
&clean::WherePredicate::RegionPredicate { ref lifetime, ref bounds } => {
clause.push_str(&format!("{}: {}",
lifetime,
bounds.iter()
.map(|b| b.to_string())
.collect::<Vec<_>>()
.join(" + ")));
lifetime,
bounds.iter()
.map(|b| b.to_string())
.collect::<Vec<_>>()
.join(" + ")));
}
&clean::WherePredicate::EqPredicate { ref lhs, ref rhs } => {
if f.alternate() {
......
此差异已折叠。
......@@ -160,22 +160,22 @@ pub fn clean_path<F>(src_root: &Path, p: &Path, keep_filename: bool, mut f: F)
struct Source<'a>(&'a str);
impl<'a> fmt::Display for Source<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let Source(s) = *self;
let lines = s.lines().count();
let mut cols = 0;
let mut tmp = lines;
while tmp > 0 {
cols += 1;
tmp /= 10;
}
write!(fmt, "<pre class=\"line-numbers\">")?;
for i in 1..=lines {
write!(fmt, "<span id=\"{0}\">{0:1$}</span>\n", i, cols)?;
}
write!(fmt, "</pre>")?;
write!(fmt, "{}",
highlight::render_with_highlighting(s, None, None, None))?;
Ok(())
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let Source(s) = *self;
let lines = s.lines().count();
let mut cols = 0;
let mut tmp = lines;
while tmp > 0 {
cols += 1;
tmp /= 10;
}
write!(fmt, "<pre class=\"line-numbers\">")?;
for i in 1..=lines {
write!(fmt, "<span id=\"{0}\">{0:1$}</span>\n", i, cols)?;
}
write!(fmt, "</pre>")?;
write!(fmt, "{}",
highlight::render_with_highlighting(s, None, None, None))?;
Ok(())
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册