]> git.lizzy.rs Git - rust.git/commitdiff
Address comments
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Fri, 6 Jul 2018 20:18:38 +0000 (23:18 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sat, 14 Jul 2018 11:57:15 +0000 (14:57 +0300)
src/librustc/hir/mod.rs
src/librustc_passes/ast_validation.rs
src/librustc_save_analysis/dump_visitor.rs
src/librustdoc/clean/mod.rs
src/libsyntax/ast.rs
src/libsyntax/parse/parser.rs
src/libsyntax/test.rs
src/libsyntax_ext/proc_macro_registrar.rs

index 09fc824750d72538d6705497692a026e84431ab4..5984f8ce5b1fe2010aa9a51dd7610cd5b0c3bda8 100644 (file)
@@ -568,7 +568,7 @@ pub fn get_named(&self, name: &InternedString) -> Option<&GenericParam> {
 
 /// 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
 }
index 4a9d3e6a1146172dd9c825e16ef81a4953a6df68..f27ca444672ab52e744bc45b01fd79701e57d32b 100644 (file)
@@ -68,7 +68,7 @@ fn invalid_visibility(&self, vis: &Visibility, note: Option<&str>) {
                                         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 {
index e0de60556a230e26b51df14fdc85f6bc5cb6f846..34dcdfb757f7390f99fc7c9b8d13c8cca505c60e 100644 (file)
@@ -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),
         }
     };
@@ -523,7 +523,7 @@ fn process_struct(
                     .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()))
index de9c8370cdba6d69d4d62ce9c875fa707f44004e..030b36c2212ae9a5ab2f011dcbc2dacdf01c7253 100644 (file)
@@ -1855,7 +1855,7 @@ fn clean(&self, cx: &DocContext) -> Type {
     }
 }
 
-#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug, Hash)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
 pub enum GenericParamDefKind {
     Lifetime,
     Type {
@@ -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,
index a7ce4404fb864d6501cf5bae753cf1b6dcc1e5f9..209e0b6d787906d64e4c439aeff1ab84dc2732f6 100644 (file)
@@ -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 }
     }
 }
@@ -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 }
     }
 }
index 8bd4a7d71d714fcbf2b0413d2cc7bacaf2a128d0..62bb5fbd04f7bc5ba702719a31a8b378d9d7cc21 100644 (file)
@@ -6999,7 +6999,7 @@ fn parse_item_(&mut self, attrs: Vec<Attribute>,
 
         // 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)
         {
index b4e1dd75b3b717b6d9bd7a0acec960e2f905f05b..d8b8d13a38c2ea3fb28f4914296f774152eeb951 100644 (file)
@@ -353,7 +353,7 @@ fn has_test_signature(_cx: &TestCtxt, i: &ast::Item) -> HasTestSignature {
                 // 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
                 };
 
index 5cbd978257532142708bc7a96be116195ee3a2b9..2522fa769c527744b58678c45d1b9189adc759c0 100644 (file)
@@ -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 \
@@ -181,7 +179,7 @@ fn collect_custom_derive(&mut self, item: &'a ast::Item, attr: &'a ast::Attribut
             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,
@@ -206,7 +204,7 @@ fn collect_attr_proc_macro(&mut self, item: &'a ast::Item, attr: &'a ast::Attrib
             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,
@@ -229,7 +227,7 @@ fn collect_bang_proc_macro(&mut self, item: &'a ast::Item, attr: &'a ast::Attrib
             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,