# begin automatic update
clippy_lints = { version = "0.0.131", path = "clippy_lints" }
# end automatic update
-cargo_metadata = "0.1.1"
+cargo_metadata = "0.2"
[dev-dependencies]
compiletest_rs = "0.2.5"
-lazy_static = "0.1.15"
+lazy_static = "0.2"
regex = "0.2"
-serde_derive = "0.9.1"
+serde_derive = "1.0"
clippy-mini-macro-test = { version = "0.1", path = "mini-macro" }
-serde = "0.9.1"
+serde = "1.0"
[features]
debugging = []
pub mod reference;
pub mod regex;
pub mod returns;
-pub mod serde;
+pub mod serde_api;
pub mod shadow;
pub mod should_assert_eq;
pub mod strings;
);
// end deprecated lints, do not remove this comment, it’s used in `update_lints`
- reg.register_late_lint_pass(box serde::Serde);
+ reg.register_late_lint_pass(box serde_api::Serde);
reg.register_early_lint_pass(box utils::internal_lints::Clippy);
reg.register_late_lint_pass(box utils::internal_lints::LintWithoutLintPass::default());
reg.register_late_lint_pass(box utils::inspector::Pass);
+++ /dev/null
-use rustc::lint::*;
-use rustc::hir::*;
-use utils::{span_lint, get_trait_def_id, paths};
-
-/// **What it does:** Checks for mis-uses of the serde API.
-///
-/// **Why is this bad?** Serde is very finnicky about how its API should be
-/// used, but the type system can't be used to enforce it (yet).
-///
-/// **Known problems:** None.
-///
-/// **Example:** Implementing `Visitor::visit_string` but not `Visitor::visit_str`.
-declare_lint! {
- pub SERDE_API_MISUSE,
- Warn,
- "various things that will negatively affect your serde experience"
-}
-
-
-#[derive(Copy, Clone)]
-pub struct Serde;
-
-impl LintPass for Serde {
- fn get_lints(&self) -> LintArray {
- lint_array!(SERDE_API_MISUSE)
- }
-}
-
-impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Serde {
- fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
- if let ItemImpl(_, _, _, _, Some(ref trait_ref), _, ref items) = item.node {
- let did = trait_ref.path.def.def_id();
- if let Some(visit_did) = get_trait_def_id(cx, &paths::SERDE_DE_VISITOR) {
- if did == visit_did {
- let mut seen_str = None;
- let mut seen_string = None;
- for item in items {
- match &*item.name.as_str() {
- "visit_str" => seen_str = Some(item.span),
- "visit_string" => seen_string = Some(item.span),
- _ => {},
- }
- }
- if let Some(span) = seen_string {
- if seen_str.is_none() {
- span_lint(cx,
- SERDE_API_MISUSE,
- span,
- "you should not implement `visit_string` without also implementing `visit_str`");
- }
- }
- }
- }
- }
- }
-}
--- /dev/null
+use rustc::lint::*;
+use rustc::hir::*;
+use utils::{span_lint, get_trait_def_id, paths};
+
+/// **What it does:** Checks for mis-uses of the serde API.
+///
+/// **Why is this bad?** Serde is very finnicky about how its API should be
+/// used, but the type system can't be used to enforce it (yet).
+///
+/// **Known problems:** None.
+///
+/// **Example:** Implementing `Visitor::visit_string` but not `Visitor::visit_str`.
+declare_lint! {
+ pub SERDE_API_MISUSE,
+ Warn,
+ "various things that will negatively affect your serde experience"
+}
+
+
+#[derive(Copy, Clone)]
+pub struct Serde;
+
+impl LintPass for Serde {
+ fn get_lints(&self) -> LintArray {
+ lint_array!(SERDE_API_MISUSE)
+ }
+}
+
+impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Serde {
+ fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) {
+ if let ItemImpl(_, _, _, _, Some(ref trait_ref), _, ref items) = item.node {
+ let did = trait_ref.path.def.def_id();
+ if let Some(visit_did) = get_trait_def_id(cx, &paths::SERDE_DE_VISITOR) {
+ if did == visit_did {
+ let mut seen_str = None;
+ let mut seen_string = None;
+ for item in items {
+ match &*item.name.as_str() {
+ "visit_str" => seen_str = Some(item.span),
+ "visit_string" => seen_string = Some(item.span),
+ _ => {},
+ }
+ }
+ if let Some(span) = seen_string {
+ if seen_str.is_none() {
+ span_lint(cx,
+ SERDE_API_MISUSE,
+ span,
+ "you should not implement `visit_string` without also implementing `visit_str`");
+ }
+ }
+ }
+ }
+ }
+ }
+}
struct A;
-impl serde::de::Visitor for A {
+impl<'de> serde::de::Visitor<'de> for A {
type Value = ();
fn expecting(&self, _: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
struct B;
-impl serde::de::Visitor for B {
+impl<'de> serde::de::Visitor<'de> for B {
type Value = ();
fn expecting(&self, _: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {