} else {
return FfiUnsafe {
ty,
- reason: format!("box cannot be represented as a single pointer"),
+ reason: "box cannot be represented as a single pointer".to_string(),
help: None,
};
}
let mut check_dup = |span: Span, str: &str, errors: &mut Errors| {
if let Some(prev_span) = keys.get(str) {
errors.error(span, format!("Symbol `{}` is duplicated", str));
- errors.error(*prev_span, format!("location of previous definition"));
+ errors.error(*prev_span, "location of previous definition".to_string());
} else {
keys.insert(str.to_string(), span);
}
.map(|n| format!("`{}`", n))
.unwrap_or_else(|| "the mutable reference".to_string()),
),
- format!("&mut *"),
+ "&mut *".to_string(),
Applicability::MachineApplicable,
);
}
if suggestions.peek().is_some() {
err.span_suggestions(
path_segment.ident.span,
- &format!("use mutable method"),
+ "use mutable method",
suggestions,
Applicability::MaybeIncorrect,
);
);
err.span_label(
span,
- format!("this borrow of an interior mutable value may end up in the final value"),
+ "this borrow of an interior mutable value may end up in the final value",
);
if let hir::ConstContext::Static(_) = ccx.const_kind() {
err.help(
return if counter_format.id {
format!("{}#{}", block_label, id.index())
} else {
- format!("{}", block_label)
+ block_label.to_string()
};
}
}
}
return format!("({})", self.format_counter_kind(counter_kind));
}
- return format!("{}", self.format_counter_kind(counter_kind));
+ return self.format_counter_kind(counter_kind).to_string();
}
}
format!("#{}", operand.index().to_string())
match &args[2] {
Operand::Constant(_) => {} // all good
_ => {
- let msg = format!("last argument of `simd_shuffle` is required to be a `const` item");
- tcx.sess.span_err(span, &msg);
+ let msg = "last argument of `simd_shuffle` is required to be a `const` item";
+ tcx.sess.span_err(span, msg);
}
}
}
uv.promoted
),
ty::ConstKind::Value(val) => format!("Value({:?})", val),
- ty::ConstKind::Error(_) => format!("Error"),
+ ty::ConstKind::Error(_) => "Error".to_string(),
};
self.push(&format!("+ val: {}", val));
}
hir_id,
meta.span(),
|lint| {
- lint.build(&format!("invalid `doc` attribute")).emit();
+ lint.build(&"invalid `doc` attribute").emit();
},
);
is_valid = false;
if let Some(main_def) = tcx.resolutions(()).main_def {
if main_def.opt_fn_def_id().is_none() {
// There is something at `crate::main`, but it is not a function definition.
- err.span_label(main_def.span, &format!("non-function item at `crate::main` is found"));
+ err.span_label(main_def.span, "non-function item at `crate::main` is found");
}
}
};
tcx.sess().struct_err(&format!("internal compiler error: encountered incremental compilation error with {:?}", dep_node))
.help(&format!("This is a known issue with the compiler. Run {} to allow your project to compile", run_cmd))
- .note(&format!("Please follow the instructions below to create a bug report with the provided information"))
- .note(&format!("See <https://github.com/rust-lang/rust/issues/84970> for more information"))
+ .note(&"Please follow the instructions below to create a bug report with the provided information")
+ .note(&"See <https://github.com/rust-lang/rust/issues/84970> for more information")
.emit();
panic!("Found unstable fingerprints for {:?}: {:?}", dep_node, result);
}
}
err.span_suggestion(
span,
- &format!("use this syntax instead"),
+ &"use this syntax instead",
format!("{path_str}"),
Applicability::MaybeIncorrect,
);
if base.is_builtin {
// This can cause unfortunate ICEs later down the line.
- return Err(format!("may not set is_builtin for targets not built-in"));
+ return Err("may not set is_builtin for targets not built-in".to_string());
}
// Each field should have been read using `Json::remove_key` so any keys remaining are unused.
let remaining_keys = obj.as_object().ok_or("Expected JSON object for target")?.keys();
if let Ok(expr_text) = self.sess().source_map().span_to_snippet(expr.span) {
(expr_text, true)
} else {
- (format!("(..)"), false)
+ ("(..)".to_string(), false)
};
let adjusted_text = if let Some(probe::AutorefOrPtrAdjustment::ToConstPtr) =