Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Jul 14, 2018
1 parent e3acb34 commit 7d142c1
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/librustc/hir/mod.rs
Expand Up @@ -568,7 +568,7 @@ impl Generics {

/// 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
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_passes/ast_validation.rs
Expand Up @@ -68,7 +68,7 @@ impl<'a> AstValidator<'a> {
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 {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_save_analysis/dump_visitor.rs
Expand Up @@ -65,14 +65,14 @@ macro_rules! down_cast_data {
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),
}
};
Expand Down Expand Up @@ -523,7 +523,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
.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()))
Expand Down
4 changes: 1 addition & 3 deletions src/librustdoc/clean/mod.rs
Expand Up @@ -1855,7 +1855,7 @@ impl<'tcx> Clean<Type> for ty::ProjectionTy<'tcx> {
}
}

#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug, Hash)]
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
pub enum GenericParamDefKind {
Lifetime,
Type {
Expand All @@ -1866,8 +1866,6 @@ pub enum GenericParamDefKind {
},
}

impl Eq for GenericParamDefKind {}

#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
pub struct GenericParamDef {
pub name: String,
Expand Down
5 changes: 3 additions & 2 deletions src/libsyntax/ast.rs
Expand Up @@ -1581,7 +1581,8 @@ impl TyKind {
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 }
}
}
Expand Down Expand Up @@ -1982,7 +1983,7 @@ pub enum VisibilityKind {
}

impl VisibilityKind {
pub fn is_public(&self) -> bool {
pub fn is_pub(&self) -> bool {
if let VisibilityKind::Public = *self { true } else { false }
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/parse/parser.rs
Expand Up @@ -6999,7 +6999,7 @@ impl<'a> Parser<'a> {

// 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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/test.rs
Expand Up @@ -353,7 +353,7 @@ fn is_test_fn(cx: &TestCtxt, i: &ast::Item) -> bool {
// 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
};

Expand Down
10 changes: 4 additions & 6 deletions src/libsyntax_ext/proc_macro_registrar.rs
Expand Up @@ -101,9 +101,7 @@ fn is_proc_macro_attr(attr: &ast::Attribute) -> bool {

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 \
Expand Down Expand Up @@ -181,7 +179,7 @@ impl<'a> CollectProcMacros<'a> {
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,
Expand All @@ -206,7 +204,7 @@ impl<'a> CollectProcMacros<'a> {
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,
Expand All @@ -229,7 +227,7 @@ impl<'a> CollectProcMacros<'a> {
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,
Expand Down

0 comments on commit 7d142c1

Please sign in to comment.