Skip to content

Commit

Permalink
Fix dogfood test
Browse files Browse the repository at this point in the history
  • Loading branch information
rudyardrichter committed May 28, 2018
1 parent ebfda29 commit 5958ddf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion clippy_lints/src/use_shared_from_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ impl <'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
if match_type(cx, expr_ty, &paths::RC);
if match_type(cx, subst.type_at(1), &paths::VEC);
then {
cx.sess().note_without_error(&format!("{:?}", subst));
span_lint_and_sugg(
cx,
USE_SHARED_FROM_SLICE,
expr.span,
"constructing reference-counted type from vec",
"consider using `into()`",
format!("TODO"),
format!("{}", "TODO"),
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/use_shared_from_slice.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::rc::Rc;

fn main() {
let bad_ref: Rc<Vec<usize>> = Rc::new(vec!(1, 2, 3));
let _bad_ref: Rc<Vec<usize>> = Rc::new(vec!(1, 2, 3));

let good_ref: Rc<[usize]> = vec!(1, 2, 3).into();
let _good_ref: Rc<[usize]> = vec!(1, 2, 3).into();
}

0 comments on commit 5958ddf

Please sign in to comment.