mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-19 20:13:47 +00:00
Restore some of rustfmt madness
This commit is contained in:
parent
527af79993
commit
0c726e8077
196
src/methods.rs
196
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user