mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
Address PR's comments
This commit is contained in:
parent
02547b9392
commit
bf513229b1
3 changed files with 5 additions and 5 deletions
|
@ -59,7 +59,7 @@ impl LateLintPass for NeedlessBool {
|
||||||
};
|
};
|
||||||
|
|
||||||
let hint = if ret {
|
let hint = if ret {
|
||||||
format!("return {};", snip)
|
format!("return {}", snip)
|
||||||
} else {
|
} else {
|
||||||
snip.to_string()
|
snip.to_string()
|
||||||
};
|
};
|
||||||
|
|
|
@ -95,9 +95,9 @@ impl LateLintPass for Transmute {
|
||||||
|db| {
|
|db| {
|
||||||
if let Some(arg) = sugg::Sugg::hir_opt(cx, &*args[0]) {
|
if let Some(arg) = sugg::Sugg::hir_opt(cx, &*args[0]) {
|
||||||
let sugg = if ptr_ty == rty {
|
let sugg = if ptr_ty == rty {
|
||||||
arg.as_ty(&to_ty.to_string())
|
arg.as_ty(to_ty)
|
||||||
} else {
|
} 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());
|
db.span_suggestion(e.span, "try", sugg.to_string());
|
||||||
|
|
|
@ -126,8 +126,8 @@ impl<'a> Sugg<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convenience method to create the `<lhs> as <rhs>` suggestion.
|
/// Convenience method to create the `<lhs> as <rhs>` suggestion.
|
||||||
pub fn as_ty(self, rhs: &str) -> Sugg<'static> {
|
pub fn as_ty<R: std::fmt::Display>(self, rhs: R) -> Sugg<'static> {
|
||||||
make_assoc(AssocOp::As, &self, &Sugg::NonParen(rhs.into()))
|
make_assoc(AssocOp::As, &self, &Sugg::NonParen(rhs.to_string().into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convenience method to create the `&<expr>` suggestion.
|
/// Convenience method to create the `&<expr>` suggestion.
|
||||||
|
|
Loading…
Reference in a new issue