Skip to content

Commit bf51322

Browse files
committed
Address PR's comments
1 parent 02547b9 commit bf51322

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

clippy_lints/src/needless_bool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl LateLintPass for NeedlessBool {
5959
};
6060

6161
let hint = if ret {
62-
format!("return {};", snip)
62+
format!("return {}", snip)
6363
} else {
6464
snip.to_string()
6565
};

clippy_lints/src/transmute.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ impl LateLintPass for Transmute {
9595
|db| {
9696
if let Some(arg) = sugg::Sugg::hir_opt(cx, &*args[0]) {
9797
let sugg = if ptr_ty == rty {
98-
arg.as_ty(&to_ty.to_string())
98+
arg.as_ty(to_ty)
9999
} else {
100-
arg.as_ty(&format!("{} as {}", cx.tcx.mk_ptr(rty), to_ty))
100+
arg.as_ty(cx.tcx.mk_ptr(rty)).as_ty(to_ty)
101101
};
102102

103103
db.span_suggestion(e.span, "try", sugg.to_string());

clippy_lints/src/utils/sugg.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ impl<'a> Sugg<'a> {
126126
}
127127

128128
/// Convenience method to create the `<lhs> as <rhs>` suggestion.
129-
pub fn as_ty(self, rhs: &str) -> Sugg<'static> {
130-
make_assoc(AssocOp::As, &self, &Sugg::NonParen(rhs.into()))
129+
pub fn as_ty<R: std::fmt::Display>(self, rhs: R) -> Sugg<'static> {
130+
make_assoc(AssocOp::As, &self, &Sugg::NonParen(rhs.to_string().into()))
131131
}
132132

133133
/// Convenience method to create the `&<expr>` suggestion.

0 commit comments

Comments
 (0)