Skip to content

Commit

Permalink
Address PR's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarton committed Jul 6, 2016
1 parent 02547b9 commit bf51322
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/needless_bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl LateLintPass for NeedlessBool {
};

let hint = if ret {
format!("return {};", snip)
format!("return {}", snip)
} else {
snip.to_string()
};
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/transmute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/utils/sugg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit bf51322

Please sign in to comment.