mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +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 {
|
||||
format!("return {};", snip)
|
||||
format!("return {}", snip)
|
||||
} else {
|
||||
snip.to_string()
|
||||
};
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue