/// Synthetic Type Parameters are converted to an other form during lowering, this allows
/// to track the original form they had. Useful for error messages.
-#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
+#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub enum SyntheticTyParamKind {
ImplTrait
}
vis.span,
E0449,
"unnecessary visibility qualifier");
- if vis.node.is_public() {
+ if vis.node.is_pub() {
err.span_label(vis.span, "`pub` not permitted here because it's implied");
}
if let Some(note) = note {
macro_rules! access_from {
($save_ctxt:expr, $vis:expr, $id:expr) => {
Access {
- public: $vis.node.is_public(),
+ public: $vis.node.is_pub(),
reachable: $save_ctxt.analysis.access_levels.is_reachable($id),
}
};
($save_ctxt:expr, $item:expr) => {
Access {
- public: $item.vis.node.is_public(),
+ public: $item.vis.node.is_pub(),
reachable: $save_ctxt.analysis.access_levels.is_reachable($item.id),
}
};
.iter()
.enumerate()
.filter_map(|(i, f)| {
- if include_priv_fields || f.vis.node.is_public() {
+ if include_priv_fields || f.vis.node.is_pub() {
f.ident
.map(|i| i.to_string())
.or_else(|| Some(i.to_string()))
}
}
-#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug, Hash)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
pub enum GenericParamDefKind {
Lifetime,
Type {
},
}
-impl Eq for GenericParamDefKind {}
-
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
pub struct GenericParamDef {
pub name: String,
pub fn is_implicit_self(&self) -> bool {
if let TyKind::ImplicitSelf = *self { true } else { false }
}
- pub(crate) fn is_empty_tuple(&self) -> bool {
+
+ crate fn is_unit(&self) -> bool {
if let TyKind::Tup(ref tys) = *self { tys.is_empty() } else { false }
}
}
}
impl VisibilityKind {
- pub fn is_public(&self) -> bool {
+ pub fn is_pub(&self) -> bool {
if let VisibilityKind::Public = *self { true } else { false }
}
}
// Verify whether we have encountered a struct or method definition where the user forgot to
// add the `struct` or `fn` keyword after writing `pub`: `pub S {}`
- if visibility.node.is_public() &&
+ if visibility.node.is_pub() &&
self.check_ident() &&
self.look_ahead(1, |t| *t != token::Not)
{
// type implements the `Termination` trait as `libtest` enforces that.
let has_output = match decl.output {
ast::FunctionRetTy::Default(..) => false,
- ast::FunctionRetTy::Ty(ref t) if t.node.is_empty_tuple() => false,
+ ast::FunctionRetTy::Ty(ref t) if t.node.is_unit() => false,
_ => true
};
impl<'a> CollectProcMacros<'a> {
fn check_not_pub_in_root(&self, vis: &ast::Visibility, sp: Span) {
- if self.is_proc_macro_crate &&
- self.in_root &&
- vis.node.is_public() {
+ if self.is_proc_macro_crate && self.in_root && vis.node.is_pub() {
self.handler.span_err(sp,
"`proc-macro` crate types cannot \
export any items other than functions \
Vec::new()
};
- if self.in_root && item.vis.node.is_public() {
+ if self.in_root && item.vis.node.is_pub() {
self.derives.push(ProcMacroDerive {
span: item.span,
trait_name,
return;
}
- if self.in_root && item.vis.node.is_public() {
+ if self.in_root && item.vis.node.is_pub() {
self.attr_macros.push(ProcMacroDef {
span: item.span,
function_name: item.ident,
return;
}
- if self.in_root && item.vis.node.is_public() {
+ if self.in_root && item.vis.node.is_pub() {
self.bang_macros.push(ProcMacroDef {
span: item.span,
function_name: item.ident,