From 0c726e8077f9effe36dfa1358f87e71c941961f0 Mon Sep 17 00:00:00 2001 From: mcarton Date: Sat, 30 Jan 2016 13:39:16 +0100 Subject: [PATCH] Restore some of rustfmt madness --- src/methods.rs | 196 +++++++++++-------------------------------------- 1 file changed, 41 insertions(+), 155 deletions(-) diff --git a/src/methods.rs b/src/methods.rs index 111f4d56424..dfa9a90d9cf 100644 --- a/src/methods.rs +++ b/src/methods.rs @@ -728,162 +728,48 @@ fn has_debug_impl<'a, 'b>(ty: ty::Ty<'a>, cx: &LateContext<'b, 'a>) -> bool { debug_impl_exists } -const CONVENTIONS: [(&'static str, &'static [SelfKind]); 5] = [("into_", &[SelfKind::Value]), - ("to_", &[SelfKind::Ref]), - ("as_", &[SelfKind::Ref, SelfKind::RefMut]), - ("is_", &[SelfKind::Ref, SelfKind::No]), - ("from_", &[SelfKind::No])]; +#[rustfmt_skip] +const CONVENTIONS: [(&'static str, &'static [SelfKind]); 5] = [ + ("into_", &[SelfKind::Value]), + ("to_", &[SelfKind::Ref]), + ("as_", &[SelfKind::Ref, SelfKind::RefMut]), + ("is_", &[SelfKind::Ref, SelfKind::No]), + ("from_", &[SelfKind::No]), +]; -const TRAIT_METHODS: [(&'static str, usize, SelfKind, OutType, &'static str); 30] = [("add", - 2, - SelfKind::Value, - OutType::Any, - "std::ops::Add"), - ("sub", - 2, - SelfKind::Value, - OutType::Any, - "std::ops::Sub"), - ("mul", - 2, - SelfKind::Value, - OutType::Any, - "std::ops::Mul"), - ("div", - 2, - SelfKind::Value, - OutType::Any, - "std::ops::Div"), - ("rem", - 2, - SelfKind::Value, - OutType::Any, - "std::ops::Rem"), - ("shl", - 2, - SelfKind::Value, - OutType::Any, - "std::ops::Shl"), - ("shr", - 2, - SelfKind::Value, - OutType::Any, - "std::ops::Shr"), - ("bitand", - 2, - SelfKind::Value, - OutType::Any, - "std::ops::BitAnd"), - ("bitor", - 2, - SelfKind::Value, - OutType::Any, - "std::ops::BitOr"), - ("bitxor", - 2, - SelfKind::Value, - OutType::Any, - "std::ops::BitXor"), - ("neg", - 1, - SelfKind::Value, - OutType::Any, - "std::ops::Neg"), - ("not", - 1, - SelfKind::Value, - OutType::Any, - "std::ops::Not"), - ("drop", - 1, - SelfKind::RefMut, - OutType::Unit, - "std::ops::Drop"), - ("index", - 2, - SelfKind::Ref, - OutType::Ref, - "std::ops::Index"), - ("index_mut", - 2, - SelfKind::RefMut, - OutType::Ref, - "std::ops::IndexMut"), - ("deref", - 1, - SelfKind::Ref, - OutType::Ref, - "std::ops::Deref"), - ("deref_mut", - 1, - SelfKind::RefMut, - OutType::Ref, - "std::ops::DerefMut"), - ("clone", - 1, - SelfKind::Ref, - OutType::Any, - "std::clone::Clone"), - ("borrow", - 1, - SelfKind::Ref, - OutType::Ref, - "std::borrow::Borrow"), - ("borrow_mut", - 1, - SelfKind::RefMut, - OutType::Ref, - "std::borrow::BorrowMut"), - ("as_ref", - 1, - SelfKind::Ref, - OutType::Ref, - "std::convert::AsRef"), - ("as_mut", - 1, - SelfKind::RefMut, - OutType::Ref, - "std::convert::AsMut"), - ("eq", - 2, - SelfKind::Ref, - OutType::Bool, - "std::cmp::PartialEq"), - ("cmp", - 2, - SelfKind::Ref, - OutType::Any, - "std::cmp::Ord"), - ("default", - 0, - SelfKind::No, - OutType::Any, - "std::default::Default"), - ("hash", - 2, - SelfKind::Ref, - OutType::Unit, - "std::hash::Hash"), - ("next", - 1, - SelfKind::RefMut, - OutType::Any, - "std::iter::Iterator"), - ("into_iter", - 1, - SelfKind::Value, - OutType::Any, - "std::iter::IntoIterator"), - ("from_iter", - 1, - SelfKind::No, - OutType::Any, - "std::iter::FromIterator"), - ("from_str", - 1, - SelfKind::No, - OutType::Any, - "std::str::FromStr")]; +#[rustfmt_skip] +const TRAIT_METHODS: [(&'static str, usize, SelfKind, OutType, &'static str); 30] = [ + ("add", 2, SelfKind::Value, OutType::Any, "std::ops::Add"), + ("sub", 2, SelfKind::Value, OutType::Any, "std::ops::Sub"), + ("mul", 2, SelfKind::Value, OutType::Any, "std::ops::Mul"), + ("div", 2, SelfKind::Value, OutType::Any, "std::ops::Div"), + ("rem", 2, SelfKind::Value, OutType::Any, "std::ops::Rem"), + ("shl", 2, SelfKind::Value, OutType::Any, "std::ops::Shl"), + ("shr", 2, SelfKind::Value, OutType::Any, "std::ops::Shr"), + ("bitand", 2, SelfKind::Value, OutType::Any, "std::ops::BitAnd"), + ("bitor", 2, SelfKind::Value, OutType::Any, "std::ops::BitOr"), + ("bitxor", 2, SelfKind::Value, OutType::Any, "std::ops::BitXor"), + ("neg", 1, SelfKind::Value, OutType::Any, "std::ops::Neg"), + ("not", 1, SelfKind::Value, OutType::Any, "std::ops::Not"), + ("drop", 1, SelfKind::RefMut, OutType::Unit, "std::ops::Drop"), + ("index", 2, SelfKind::Ref, OutType::Ref, "std::ops::Index"), + ("index_mut", 2, SelfKind::RefMut, OutType::Ref, "std::ops::IndexMut"), + ("deref", 1, SelfKind::Ref, OutType::Ref, "std::ops::Deref"), + ("deref_mut", 1, SelfKind::RefMut, OutType::Ref, "std::ops::DerefMut"), + ("clone", 1, SelfKind::Ref, OutType::Any, "std::clone::Clone"), + ("borrow", 1, SelfKind::Ref, OutType::Ref, "std::borrow::Borrow"), + ("borrow_mut", 1, SelfKind::RefMut, OutType::Ref, "std::borrow::BorrowMut"), + ("as_ref", 1, SelfKind::Ref, OutType::Ref, "std::convert::AsRef"), + ("as_mut", 1, SelfKind::RefMut, OutType::Ref, "std::convert::AsMut"), + ("eq", 2, SelfKind::Ref, OutType::Bool, "std::cmp::PartialEq"), + ("cmp", 2, SelfKind::Ref, OutType::Any, "std::cmp::Ord"), + ("default", 0, SelfKind::No, OutType::Any, "std::default::Default"), + ("hash", 2, SelfKind::Ref, OutType::Unit, "std::hash::Hash"), + ("next", 1, SelfKind::RefMut, OutType::Any, "std::iter::Iterator"), + ("into_iter", 1, SelfKind::Value, OutType::Any, "std::iter::IntoIterator"), + ("from_iter", 1, SelfKind::No, OutType::Any, "std::iter::FromIterator"), + ("from_str", 1, SelfKind::No, OutType::Any, "std::str::FromStr"), +]; #[derive(Clone, Copy)] enum SelfKind {