Skip to content

Commit f9d0968

Browse files
committed
Make method and variable names more consistent
1 parent 76c0d68 commit f9d0968

File tree

28 files changed

+182
-163
lines changed

28 files changed

+182
-163
lines changed

src/librustc/hir/lowering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,7 @@ impl<'a> LoweringContext<'a> {
17261726
hir::PathSegment::new(
17271727
self.lower_ident(segment.ident),
17281728
generic_args,
1729-
infer_types
1729+
infer_types,
17301730
)
17311731
}
17321732

@@ -1738,7 +1738,7 @@ impl<'a> LoweringContext<'a> {
17381738
) -> (hir::GenericArgs, bool) {
17391739
let &AngleBracketedArgs { ref args, ref bindings, .. } = data;
17401740
(hir::GenericArgs {
1741-
args: args.iter().map(|p| self.lower_generic_arg(p, itctx)).collect(),
1741+
args: args.iter().map(|a| self.lower_generic_arg(a, itctx)).collect(),
17421742
bindings: bindings.iter().map(|b| self.lower_ty_binding(b, itctx)).collect(),
17431743
parenthesized: false,
17441744
},

src/librustc/hir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ impl PathSegment {
360360

361361
// FIXME: hack required because you can't create a static
362362
// GenericArgs, so you can't just return a &GenericArgs.
363-
pub fn with_args<F, R>(&self, f: F) -> R
363+
pub fn with_generic_args<F, R>(&self, f: F) -> R
364364
where F: FnOnce(&GenericArgs) -> R
365365
{
366366
let dummy = GenericArgs::none();

src/librustc/hir/print.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,11 +1269,11 @@ impl<'a> State<'a> {
12691269
self.s.word(".")?;
12701270
self.print_name(segment.name)?;
12711271

1272-
segment.with_args(|args| {
1273-
if !args.args.is_empty() ||
1274-
!args.bindings.is_empty()
1272+
segment.with_generic_args(|generic_args| {
1273+
if !generic_args.args.is_empty() ||
1274+
!generic_args.bindings.is_empty()
12751275
{
1276-
self.print_generic_args(&args, segment.infer_types, true)
1276+
self.print_generic_args(&generic_args, segment.infer_types, true)
12771277
} else {
12781278
Ok(())
12791279
}
@@ -1641,10 +1641,10 @@ impl<'a> State<'a> {
16411641
if segment.name != keywords::CrateRoot.name() &&
16421642
segment.name != keywords::DollarCrate.name() {
16431643
self.print_name(segment.name)?;
1644-
segment.with_args(|parameters| {
1645-
self.print_generic_args(parameters,
1646-
segment.infer_types,
1647-
colons_before_params)
1644+
segment.with_generic_args(|generic_args| {
1645+
self.print_generic_args(generic_args,
1646+
segment.infer_types,
1647+
colons_before_params)
16481648
})?;
16491649
}
16501650
}
@@ -1673,10 +1673,10 @@ impl<'a> State<'a> {
16731673
if segment.name != keywords::CrateRoot.name() &&
16741674
segment.name != keywords::DollarCrate.name() {
16751675
self.print_name(segment.name)?;
1676-
segment.with_args(|parameters| {
1677-
self.print_generic_args(parameters,
1678-
segment.infer_types,
1679-
colons_before_params)
1676+
segment.with_generic_args(|generic_args| {
1677+
self.print_generic_args(generic_args,
1678+
segment.infer_types,
1679+
colons_before_params)
16801680
})?;
16811681
}
16821682
}
@@ -1685,10 +1685,10 @@ impl<'a> State<'a> {
16851685
self.s.word("::")?;
16861686
let item_segment = path.segments.last().unwrap();
16871687
self.print_name(item_segment.name)?;
1688-
item_segment.with_args(|parameters| {
1689-
self.print_generic_args(parameters,
1690-
item_segment.infer_types,
1691-
colons_before_params)
1688+
item_segment.with_generic_args(|generic_args| {
1689+
self.print_generic_args(generic_args,
1690+
item_segment.infer_types,
1691+
colons_before_params)
16921692
})
16931693
}
16941694
hir::QPath::TypeRelative(ref qself, ref item_segment) => {
@@ -1697,10 +1697,10 @@ impl<'a> State<'a> {
16971697
self.s.word(">")?;
16981698
self.s.word("::")?;
16991699
self.print_name(item_segment.name)?;
1700-
item_segment.with_args(|parameters| {
1701-
self.print_generic_args(parameters,
1702-
item_segment.infer_types,
1703-
colons_before_params)
1700+
item_segment.with_generic_args(|generic_args| {
1701+
self.print_generic_args(generic_args,
1702+
item_segment.infer_types,
1703+
colons_before_params)
17041704
})
17051705
}
17061706
}
@@ -1734,11 +1734,11 @@ impl<'a> State<'a> {
17341734
let elide_lifetimes = generic_args.lifetimes().all(|lt| lt.is_elided());
17351735
if !elide_lifetimes {
17361736
start_or_comma(self)?;
1737-
self.commasep(Inconsistent, &generic_args.args, |s, p| {
1738-
match p {
1737+
self.commasep(Inconsistent, &generic_args.args, |s, generic_arg| {
1738+
match generic_arg {
17391739
GenericArg::Lifetime(lt) => s.print_lifetime(lt),
17401740
GenericArg::Type(ty) => s.print_type(ty),
1741-
}
1741+
}
17421742
})?;
17431743
} else if generic_args.types().count() != 0 {
17441744
start_or_comma(self)?;

src/librustc/middle/resolve_lifetime.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,20 +1601,21 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
16011601
&mut self,
16021602
def: Def,
16031603
depth: usize,
1604-
args: &'tcx hir::GenericArgs,
1604+
generic_args: &'tcx hir::GenericArgs,
16051605
) {
1606-
if args.parenthesized {
1606+
if generic_args.parenthesized {
16071607
let was_in_fn_syntax = self.is_in_fn_syntax;
16081608
self.is_in_fn_syntax = true;
1609-
self.visit_fn_like_elision(args.inputs(), Some(&args.bindings[0].ty));
1609+
self.visit_fn_like_elision(generic_args.inputs(),
1610+
Some(&generic_args.bindings[0].ty));
16101611
self.is_in_fn_syntax = was_in_fn_syntax;
16111612
return;
16121613
}
16131614

1614-
if args.lifetimes().all(|l| l.is_elided()) {
1615-
self.resolve_elided_lifetimes(args.lifetimes().collect(), true);
1615+
if generic_args.lifetimes().all(|l| l.is_elided()) {
1616+
self.resolve_elided_lifetimes(generic_args.lifetimes().collect(), true);
16161617
} else {
1617-
for l in args.lifetimes() {
1618+
for l in generic_args.lifetimes() {
16181619
self.visit_lifetime(l);
16191620
}
16201621
}
@@ -1686,13 +1687,13 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
16861687
} else {
16871688
Some(Region::Static)
16881689
},
1689-
Set1::One(r) => r.subst(args.lifetimes(), map),
1690+
Set1::One(r) => r.subst(generic_args.lifetimes(), map),
16901691
Set1::Many => None,
16911692
})
16921693
.collect()
16931694
});
16941695

1695-
for (i, ty) in args.types().enumerate() {
1696+
for (i, ty) in generic_args.types().enumerate() {
16961697
if let Some(&lt) = object_lifetime_defaults.get(i) {
16971698
let scope = Scope::ObjectLifetimeDefault {
16981699
lifetime: lt,
@@ -1704,7 +1705,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
17041705
}
17051706
}
17061707

1707-
for b in &args.bindings {
1708+
for b in &generic_args.bindings {
17081709
self.visit_assoc_type_binding(b);
17091710
}
17101711
}

src/librustc/ty/instance.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use hir::def_id::DefId;
1212
use ty::{self, Ty, TypeFoldable, Substs, TyCtxt};
13-
use ty::subst::Kind;
1413
use traits;
1514
use rustc_target::spec::abi::Abi;
1615
use util::ppaux;

src/librustc/ty/subst.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ impl<'tcx> From<Ty<'tcx>> for Kind<'tcx> {
105105
}
106106
}
107107

108-
impl<'tcx> Into<Kind<'tcx>> for ty::Region<'tcx> {}
109-
110-
impl<'tcx> Into<Kind<'tcx>> for Ty<'tcx> {}
111-
112108
impl<'tcx> Kind<'tcx> {
113109
#[inline]
114110
pub fn unpack(self) -> UnpackedKind<'tcx> {

src/librustc_codegen_llvm/base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ use rustc::middle::weak_lang_items;
4040
use rustc::mir::mono::{Linkage, Visibility, Stats};
4141
use rustc::middle::cstore::{EncodedMetadata};
4242
use rustc::ty::{self, Ty, TyCtxt};
43-
use rustc::ty::subst::Kind;
4443
use rustc::ty::layout::{self, Align, TyLayout, LayoutOf};
4544
use rustc::ty::query::Providers;
4645
use rustc::dep_graph::{DepNode, DepConstructor};

src/librustc_driver/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ impl<'a> ReplaceBodyWithLoop<'a> {
677677
ast::TyKind::Paren(ref subty) => involves_impl_trait(subty),
678678
ast::TyKind::Tup(ref tys) => any_involves_impl_trait(tys.iter()),
679679
ast::TyKind::Path(_, ref path) => path.segments.iter().any(|seg| {
680-
match seg.args.as_ref().map(|p| &**p) {
680+
match seg.args.as_ref().map(|generic_arg| &**generic_arg) {
681681
None => false,
682682
Some(&ast::GenericArgs::AngleBracketed(ref data)) =>
683683
any_involves_impl_trait(data.types().into_iter()) ||

src/librustc_mir/monomorphize/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use rustc::middle::lang_items::DropInPlaceFnLangItem;
1313
use rustc::traits;
1414
use rustc::ty::adjustment::CustomCoerceUnsized;
1515
use rustc::ty::{self, Ty, TyCtxt};
16-
use rustc::ty::subst::Kind;
1716

1817
pub use rustc::ty::Instance;
1918
pub use self::item::{MonoItem, MonoItemExt};

src/librustc_passes/ast_validation.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -523,21 +523,21 @@ impl<'a> Visitor<'a> for NestedImplTraitVisitor<'a> {
523523
}
524524
fn visit_generic_args(&mut self, _: Span, generic_args: &'a GenericArgs) {
525525
match *generic_args {
526-
GenericArgs::AngleBracketed(ref params) => {
527-
for type_ in params.types() {
526+
GenericArgs::AngleBracketed(ref generic_args) => {
527+
for type_ in generic_args.types() {
528528
self.visit_ty(type_);
529529
}
530-
for type_binding in &params.bindings {
530+
for type_binding in &generic_args.bindings {
531531
// Type bindings such as `Item=impl Debug` in `Iterator<Item=Debug>`
532532
// are allowed to contain nested `impl Trait`.
533533
self.with_impl_trait(None, |this| visit::walk_ty(this, &type_binding.ty));
534534
}
535535
}
536-
GenericArgs::Parenthesized(ref params) => {
537-
for type_ in &params.inputs {
536+
GenericArgs::Parenthesized(ref generic_args) => {
537+
for type_ in &generic_args.inputs {
538538
self.visit_ty(type_);
539539
}
540-
if let Some(ref type_) = params.output {
540+
if let Some(ref type_) = generic_args.output {
541541
// `-> Foo` syntax is essentially an associated type binding,
542542
// so it is also allowed to contain nested `impl Trait`.
543543
self.with_impl_trait(None, |this| visit::walk_ty(this, type_));

0 commit comments

Comments
 (0)