remove unnecessary to_string
and String::new
This commit is contained in:
parent
c570ab5a0b
commit
77d6176e69
88 changed files with 292 additions and 340 deletions
|
@ -132,7 +132,7 @@ fn parse_assert<'a>(cx: &mut ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PRes
|
|||
err.span_suggestion(
|
||||
parser.token.span,
|
||||
"try removing semicolon",
|
||||
String::new(),
|
||||
"",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
err.emit();
|
||||
|
@ -153,7 +153,7 @@ fn parse_assert<'a>(cx: &mut ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PRes
|
|||
err.span_suggestion_short(
|
||||
comma_span,
|
||||
"try adding a comma",
|
||||
", ".to_string(),
|
||||
", ",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
err.emit();
|
||||
|
|
|
@ -142,7 +142,7 @@ fn report_path_args(sess: &Session, meta: &ast::MetaItem) {
|
|||
let report_error = |title, action| {
|
||||
let span = meta.span.with_lo(meta.path.span.hi());
|
||||
sess.struct_span_err(span, title)
|
||||
.span_suggestion(span, action, String::new(), Applicability::MachineApplicable)
|
||||
.span_suggestion(span, action, "", Applicability::MachineApplicable)
|
||||
.emit();
|
||||
};
|
||||
match meta.kind {
|
||||
|
|
|
@ -118,7 +118,7 @@ pub fn expand_test_or_bench(
|
|||
};
|
||||
err.span_label(attr_sp, "the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions")
|
||||
.span_label(item.span, format!("expected a non-associated function, found {} {}", item.kind.article(), item.kind.descr()))
|
||||
.span_suggestion(attr_sp, "replace with conditional compilation to make the item only exist when tests are being run", String::from("#[cfg(test)]"), Applicability::MaybeIncorrect)
|
||||
.span_suggestion(attr_sp, "replace with conditional compilation to make the item only exist when tests are being run", "#[cfg(test)]", Applicability::MaybeIncorrect)
|
||||
.emit();
|
||||
|
||||
return vec![Annotatable::Item(item)];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue