Address PR's comments

This commit is contained in:
mcarton 2016-07-06 15:36:42 +02:00
parent 02547b9392
commit bf513229b1
No known key found for this signature in database
GPG key ID: 5E427C794CBA45E8
3 changed files with 5 additions and 5 deletions

View file

@ -59,7 +59,7 @@ impl LateLintPass for NeedlessBool {
};
let hint = if ret {
format!("return {};", snip)
format!("return {}", snip)
} else {
snip.to_string()
};

View file

@ -95,9 +95,9 @@ impl LateLintPass for Transmute {
|db| {
if let Some(arg) = sugg::Sugg::hir_opt(cx, &*args[0]) {
let sugg = if ptr_ty == rty {
arg.as_ty(&to_ty.to_string())
arg.as_ty(to_ty)
} else {
arg.as_ty(&format!("{} as {}", cx.tcx.mk_ptr(rty), to_ty))
arg.as_ty(cx.tcx.mk_ptr(rty)).as_ty(to_ty)
};
db.span_suggestion(e.span, "try", sugg.to_string());

View file

@ -126,8 +126,8 @@ impl<'a> Sugg<'a> {
}
/// Convenience method to create the `<lhs> as <rhs>` suggestion.
pub fn as_ty(self, rhs: &str) -> Sugg<'static> {
make_assoc(AssocOp::As, &self, &Sugg::NonParen(rhs.into()))
pub fn as_ty<R: std::fmt::Display>(self, rhs: R) -> Sugg<'static> {
make_assoc(AssocOp::As, &self, &Sugg::NonParen(rhs.to_string().into()))
}
/// Convenience method to create the `&<expr>` suggestion.