Skip to content

Commit 7d142c1

Browse files
committed
Address comments
1 parent e3acb34 commit 7d142c1

File tree

8 files changed

+15
-18
lines changed

8 files changed

+15
-18
lines changed

src/librustc/hir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ impl Generics {
568568

569569
/// Synthetic Type Parameters are converted to an other form during lowering, this allows
570570
/// to track the original form they had. Useful for error messages.
571-
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
571+
#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
572572
pub enum SyntheticTyParamKind {
573573
ImplTrait
574574
}

src/librustc_passes/ast_validation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'a> AstValidator<'a> {
6868
vis.span,
6969
E0449,
7070
"unnecessary visibility qualifier");
71-
if vis.node.is_public() {
71+
if vis.node.is_pub() {
7272
err.span_label(vis.span, "`pub` not permitted here because it's implied");
7373
}
7474
if let Some(note) = note {

src/librustc_save_analysis/dump_visitor.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ macro_rules! down_cast_data {
6565
macro_rules! access_from {
6666
($save_ctxt:expr, $vis:expr, $id:expr) => {
6767
Access {
68-
public: $vis.node.is_public(),
68+
public: $vis.node.is_pub(),
6969
reachable: $save_ctxt.analysis.access_levels.is_reachable($id),
7070
}
7171
};
7272

7373
($save_ctxt:expr, $item:expr) => {
7474
Access {
75-
public: $item.vis.node.is_public(),
75+
public: $item.vis.node.is_pub(),
7676
reachable: $save_ctxt.analysis.access_levels.is_reachable($item.id),
7777
}
7878
};
@@ -523,7 +523,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
523523
.iter()
524524
.enumerate()
525525
.filter_map(|(i, f)| {
526-
if include_priv_fields || f.vis.node.is_public() {
526+
if include_priv_fields || f.vis.node.is_pub() {
527527
f.ident
528528
.map(|i| i.to_string())
529529
.or_else(|| Some(i.to_string()))

src/librustdoc/clean/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ impl<'tcx> Clean<Type> for ty::ProjectionTy<'tcx> {
18551855
}
18561856
}
18571857

1858-
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug, Hash)]
1858+
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
18591859
pub enum GenericParamDefKind {
18601860
Lifetime,
18611861
Type {
@@ -1866,8 +1866,6 @@ pub enum GenericParamDefKind {
18661866
},
18671867
}
18681868

1869-
impl Eq for GenericParamDefKind {}
1870-
18711869
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
18721870
pub struct GenericParamDef {
18731871
pub name: String,

src/libsyntax/ast.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1581,7 +1581,8 @@ impl TyKind {
15811581
pub fn is_implicit_self(&self) -> bool {
15821582
if let TyKind::ImplicitSelf = *self { true } else { false }
15831583
}
1584-
pub(crate) fn is_empty_tuple(&self) -> bool {
1584+
1585+
crate fn is_unit(&self) -> bool {
15851586
if let TyKind::Tup(ref tys) = *self { tys.is_empty() } else { false }
15861587
}
15871588
}
@@ -1982,7 +1983,7 @@ pub enum VisibilityKind {
19821983
}
19831984

19841985
impl VisibilityKind {
1985-
pub fn is_public(&self) -> bool {
1986+
pub fn is_pub(&self) -> bool {
19861987
if let VisibilityKind::Public = *self { true } else { false }
19871988
}
19881989
}

src/libsyntax/parse/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6999,7 +6999,7 @@ impl<'a> Parser<'a> {
69996999

70007000
// Verify whether we have encountered a struct or method definition where the user forgot to
70017001
// add the `struct` or `fn` keyword after writing `pub`: `pub S {}`
7002-
if visibility.node.is_public() &&
7002+
if visibility.node.is_pub() &&
70037003
self.check_ident() &&
70047004
self.look_ahead(1, |t| *t != token::Not)
70057005
{

src/libsyntax/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ fn is_test_fn(cx: &TestCtxt, i: &ast::Item) -> bool {
353353
// type implements the `Termination` trait as `libtest` enforces that.
354354
let has_output = match decl.output {
355355
ast::FunctionRetTy::Default(..) => false,
356-
ast::FunctionRetTy::Ty(ref t) if t.node.is_empty_tuple() => false,
356+
ast::FunctionRetTy::Ty(ref t) if t.node.is_unit() => false,
357357
_ => true
358358
};
359359

src/libsyntax_ext/proc_macro_registrar.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ fn is_proc_macro_attr(attr: &ast::Attribute) -> bool {
101101

102102
impl<'a> CollectProcMacros<'a> {
103103
fn check_not_pub_in_root(&self, vis: &ast::Visibility, sp: Span) {
104-
if self.is_proc_macro_crate &&
105-
self.in_root &&
106-
vis.node.is_public() {
104+
if self.is_proc_macro_crate && self.in_root && vis.node.is_pub() {
107105
self.handler.span_err(sp,
108106
"`proc-macro` crate types cannot \
109107
export any items other than functions \
@@ -181,7 +179,7 @@ impl<'a> CollectProcMacros<'a> {
181179
Vec::new()
182180
};
183181

184-
if self.in_root && item.vis.node.is_public() {
182+
if self.in_root && item.vis.node.is_pub() {
185183
self.derives.push(ProcMacroDerive {
186184
span: item.span,
187185
trait_name,
@@ -206,7 +204,7 @@ impl<'a> CollectProcMacros<'a> {
206204
return;
207205
}
208206

209-
if self.in_root && item.vis.node.is_public() {
207+
if self.in_root && item.vis.node.is_pub() {
210208
self.attr_macros.push(ProcMacroDef {
211209
span: item.span,
212210
function_name: item.ident,
@@ -229,7 +227,7 @@ impl<'a> CollectProcMacros<'a> {
229227
return;
230228
}
231229

232-
if self.in_root && item.vis.node.is_public() {
230+
if self.in_root && item.vis.node.is_pub() {
233231
self.bang_macros.push(ProcMacroDef {
234232
span: item.span,
235233
function_name: item.ident,

0 commit comments

Comments
 (0)