提交 6ea3ef7a 编写于 作者: M Manish Goregaokar 提交者: GitHub

Rollup merge of #35094 - mcarton:multispan, r=jonathandturner

Revert "Remove unused methods from MultiSpan"

This reverts commit f7019a4e.

That commit removed the only way to make a suggestion with more than one substitute. That feature is not used directly by rustc but exists and is used by Clippy. Bring it back until we come up with a better solution (suggestions don't use span labels, so it would make sense for them to use their own type).
Rational there: https://github.com/Manishearth/rust-clippy/pull/1119.

r? @jonathandturner
Cc @Manishearth
......@@ -193,6 +193,20 @@ pub fn new() -> MultiSpan {
}
}
pub fn from_span(primary_span: Span) -> MultiSpan {
MultiSpan {
primary_spans: vec![primary_span],
span_labels: vec![]
}
}
pub fn from_spans(vec: Vec<Span>) -> MultiSpan {
MultiSpan {
primary_spans: vec,
span_labels: vec![]
}
}
pub fn push_span_label(&mut self, span: Span, label: String) {
self.span_labels.push((span, label));
}
......@@ -240,10 +254,7 @@ pub fn span_labels(&self) -> Vec<SpanLabel> {
impl From<Span> for MultiSpan {
fn from(span: Span) -> MultiSpan {
MultiSpan {
primary_spans: vec![span],
span_labels: vec![]
}
MultiSpan::from_span(span)
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册