Update formatting
This commit is contained in:
parent
fd9c5a3c71
commit
be646ac0df
10 changed files with 17 additions and 19 deletions
|
@ -65,9 +65,7 @@ impl PartialEq for Constant {
|
||||||
f64::from(l).to_bits() == f64::from(r).to_bits()
|
f64::from(l).to_bits() == f64::from(r).to_bits()
|
||||||
},
|
},
|
||||||
(&Self::Bool(l), &Self::Bool(r)) => l == r,
|
(&Self::Bool(l), &Self::Bool(r)) => l == r,
|
||||||
(&Self::Vec(ref l), &Self::Vec(ref r)) | (&Self::Tuple(ref l), &Self::Tuple(ref r)) => {
|
(&Self::Vec(ref l), &Self::Vec(ref r)) | (&Self::Tuple(ref l), &Self::Tuple(ref r)) => l == r,
|
||||||
l == r
|
|
||||||
},
|
|
||||||
(&Self::Repeat(ref lv, ref ls), &Self::Repeat(ref rv, ref rs)) => ls == rs && lv == rv,
|
(&Self::Repeat(ref lv, ref ls), &Self::Repeat(ref rv, ref rs)) => ls == rs && lv == rv,
|
||||||
// TODO: are there inter-type equalities?
|
// TODO: are there inter-type equalities?
|
||||||
_ => false,
|
_ => false,
|
||||||
|
|
|
@ -305,7 +305,7 @@ impl EarlyLintPass for MiscEarlyLints {
|
||||||
name makes code comprehension and documentation more difficult",
|
name makes code comprehension and documentation more difficult",
|
||||||
arg_name[1..].to_owned()
|
arg_name[1..].to_owned()
|
||||||
),
|
),
|
||||||
);;
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
registered_names.insert(arg_name, arg.pat.span);
|
registered_names.insert(arg_name, arg.pat.span);
|
||||||
|
|
|
@ -127,7 +127,7 @@ fn check_open_options(cx: &LateContext<'_, '_>, options: &[(OpenOption, Argument
|
||||||
} else {
|
} else {
|
||||||
create = true
|
create = true
|
||||||
}
|
}
|
||||||
create_arg = create_arg || (arg == Argument::True);;
|
create_arg = create_arg || (arg == Argument::True);
|
||||||
},
|
},
|
||||||
(OpenOption::Append, arg) => {
|
(OpenOption::Append, arg) => {
|
||||||
if append {
|
if append {
|
||||||
|
@ -140,7 +140,7 @@ fn check_open_options(cx: &LateContext<'_, '_>, options: &[(OpenOption, Argument
|
||||||
} else {
|
} else {
|
||||||
append = true
|
append = true
|
||||||
}
|
}
|
||||||
append_arg = append_arg || (arg == Argument::True);;
|
append_arg = append_arg || (arg == Argument::True);
|
||||||
},
|
},
|
||||||
(OpenOption::Truncate, arg) => {
|
(OpenOption::Truncate, arg) => {
|
||||||
if truncate {
|
if truncate {
|
||||||
|
@ -166,7 +166,7 @@ fn check_open_options(cx: &LateContext<'_, '_>, options: &[(OpenOption, Argument
|
||||||
} else {
|
} else {
|
||||||
read = true
|
read = true
|
||||||
}
|
}
|
||||||
read_arg = read_arg || (arg == Argument::True);;
|
read_arg = read_arg || (arg == Argument::True);
|
||||||
},
|
},
|
||||||
(OpenOption::Write, arg) => {
|
(OpenOption::Write, arg) => {
|
||||||
if write {
|
if write {
|
||||||
|
@ -179,7 +179,7 @@ fn check_open_options(cx: &LateContext<'_, '_>, options: &[(OpenOption, Argument
|
||||||
} else {
|
} else {
|
||||||
write = true
|
write = true
|
||||||
}
|
}
|
||||||
write_arg = write_arg || (arg == Argument::True);;
|
write_arg = write_arg || (arg == Argument::True);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,8 @@ impl EarlyLintPass for RedundantStaticLifetimes {
|
||||||
if !in_macro_or_desugar(item.span) {
|
if !in_macro_or_desugar(item.span) {
|
||||||
if let ItemKind::Const(ref var_type, _) = item.node {
|
if let ItemKind::Const(ref var_type, _) = item.node {
|
||||||
self.visit_type(var_type, cx, "Constants have by default a `'static` lifetime");
|
self.visit_type(var_type, cx, "Constants have by default a `'static` lifetime");
|
||||||
// Don't check associated consts because `'static` cannot be elided on those (issue #2438)
|
// Don't check associated consts because `'static` cannot be elided on those (issue
|
||||||
|
// #2438)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let ItemKind::Static(ref var_type, _, _) = item.node {
|
if let ItemKind::Static(ref var_type, _, _) = item.node {
|
||||||
|
|
|
@ -222,13 +222,12 @@ impl<'a, 'tcx> Visitor<'tcx> for UseSelfVisitor<'a, 'tcx> {
|
||||||
let last_but_one = &path.segments[path.segments.len() - 2];
|
let last_but_one = &path.segments[path.segments.len() - 2];
|
||||||
if last_but_one.ident.name != kw::SelfUpper {
|
if last_but_one.ident.name != kw::SelfUpper {
|
||||||
let enum_def_id = match path.res {
|
let enum_def_id = match path.res {
|
||||||
Res::Def(DefKind::Variant, variant_def_id) =>
|
Res::Def(DefKind::Variant, variant_def_id) => self.cx.tcx.parent(variant_def_id),
|
||||||
self.cx.tcx.parent(variant_def_id),
|
|
||||||
Res::Def(DefKind::Ctor(def::CtorOf::Variant, _), ctor_def_id) => {
|
Res::Def(DefKind::Ctor(def::CtorOf::Variant, _), ctor_def_id) => {
|
||||||
let variant_def_id = self.cx.tcx.parent(ctor_def_id);
|
let variant_def_id = self.cx.tcx.parent(ctor_def_id);
|
||||||
variant_def_id.and_then(|def_id| self.cx.tcx.parent(def_id))
|
variant_def_id.and_then(|def_id| self.cx.tcx.parent(def_id))
|
||||||
}
|
},
|
||||||
_ => None
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
if self.item_path.res.opt_def_id() == enum_def_id {
|
if self.item_path.res.opt_def_id() == enum_def_id {
|
||||||
|
|
|
@ -154,5 +154,4 @@ mod test {
|
||||||
"VersionInfo { crate_name: \"rustc_tools_util\", major: 0, minor: 2, patch: 0 }"
|
"VersionInfo { crate_name: \"rustc_tools_util\", major: 0, minor: 2, patch: 0 }"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,12 @@ fn main() {
|
||||||
if x.is_ok() {
|
if x.is_ok() {
|
||||||
x = Err(());
|
x = Err(());
|
||||||
x.unwrap(); // not unnecessary because of mutation of x
|
x.unwrap(); // not unnecessary because of mutation of x
|
||||||
// it will always panic but the lint is not smart enough to see this (it only checks if conditions).
|
// it will always panic but the lint is not smart enough to see this (it only
|
||||||
|
// checks if conditions).
|
||||||
} else {
|
} else {
|
||||||
x = Ok(());
|
x = Ok(());
|
||||||
x.unwrap_err(); // not unnecessary because of mutation of x
|
x.unwrap_err(); // not unnecessary because of mutation of x
|
||||||
// it will always panic but the lint is not smart enough to see this (it only checks if conditions).
|
// it will always panic but the lint is not smart enough to see this (it
|
||||||
|
// only checks if conditions).
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,6 @@ fn test_owl_result() -> Result<(), ()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn test_owl_result_2() -> Result<u8, ()> {
|
fn test_owl_result_2() -> Result<u8, ()> {
|
||||||
produce_half_owl_error().map_err(|_| ())?;
|
produce_half_owl_error().map_err(|_| ())?;
|
||||||
|
|
|
@ -266,7 +266,7 @@ mod nesting {
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A,
|
A,
|
||||||
B(u64),
|
B(u64),
|
||||||
C { field: bool }
|
C { field: bool },
|
||||||
}
|
}
|
||||||
impl Enum {
|
impl Enum {
|
||||||
fn method() {
|
fn method() {
|
||||||
|
|
|
@ -266,7 +266,7 @@ mod nesting {
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A,
|
A,
|
||||||
B(u64),
|
B(u64),
|
||||||
C { field: bool }
|
C { field: bool },
|
||||||
}
|
}
|
||||||
impl Enum {
|
impl Enum {
|
||||||
fn method() {
|
fn method() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue