Skip to content

Commit 35585c4

Browse files
committed
Aggregation of drive-by cosmetic changes.
1 parent 47f4975 commit 35585c4

File tree

57 files changed

+550
-542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+550
-542
lines changed

src/libcore/cell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,7 @@ impl<'b> BorrowRefMut<'b> {
13511351
}
13521352
}
13531353

1354-
// Clone a `BorrowRefMut`.
1354+
// Clones a `BorrowRefMut`.
13551355
//
13561356
// This is only valid if each `BorrowRefMut` is used to track a mutable
13571357
// reference to a distinct, nonoverlapping range of the original object.

src/libcore/ops/unsize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}
7171

7272
/// This is used for object safety, to check that a method's receiver type can be dispatched on.
7373
///
74-
/// example impl:
74+
/// An example implementation of the trait:
7575
///
7676
/// ```
7777
/// # #![feature(dispatch_from_dyn, unsize)]

src/librustc/hir/intravisit.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,6 @@ pub fn walk_impl_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, impl_item_ref: &'
934934
visitor.visit_defaultness(defaultness);
935935
}
936936

937-
938937
pub fn walk_struct_def<'v, V: Visitor<'v>>(visitor: &mut V, struct_definition: &'v VariantData) {
939938
if let Some(ctor_hir_id) = struct_definition.ctor_hir_id() {
940939
visitor.visit_id(ctor_hir_id);

src/librustc/hir/lowering.rs

Lines changed: 66 additions & 59 deletions
Large diffs are not rendered by default.

src/librustc/hir/map/collector.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::iter::repeat;
1919
use crate::ich::StableHashingContext;
2020
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHasherResult};
2121

22-
/// A Visitor that walks over the HIR and collects Nodes into a HIR map
22+
/// A visitor that walks over the HIR and collects `Node`s into a HIR map.
2323
pub(super) struct NodeCollector<'a, 'hir> {
2424
/// The crate
2525
krate: &'hir Crate,
@@ -45,7 +45,7 @@ pub(super) struct NodeCollector<'a, 'hir> {
4545

4646
hcx: StableHashingContext<'a>,
4747

48-
// We are collecting DepNode::HirBody hashes here so we can compute the
48+
// We are collecting `DepNode::HirBody` hashes here so we can compute the
4949
// crate hash from then later on.
5050
hir_body_nodes: Vec<(DefPathHash, Fingerprint)>,
5151
}
@@ -109,7 +109,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
109109

110110
let mut hir_body_nodes = Vec::new();
111111

112-
// Allocate DepNodes for the root module
112+
// Allocate `DepNode`s for the root module.
113113
let (root_mod_sig_dep_index, root_mod_full_dep_index) = {
114114
let Crate {
115115
ref module,

src/librustc/hir/map/definitions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ impl DefPath {
239239
"{}[{}]",
240240
component.data.as_interned_str(),
241241
component.disambiguator)
242-
.unwrap();
242+
.unwrap();
243243
}
244244
}
245245

@@ -263,7 +263,7 @@ impl DefPath {
263263
"{}[{}]",
264264
component.data.as_interned_str(),
265265
component.disambiguator)
266-
.unwrap();
266+
.unwrap();
267267
}
268268
}
269269
s
@@ -442,7 +442,7 @@ impl Definitions {
442442
root_index
443443
}
444444

445-
/// Add a definition with a parent definition.
445+
/// Adds a definition with a parent definition.
446446
pub fn create_def_with_parent(&mut self,
447447
parent: DefIndex,
448448
node_id: ast::NodeId,
@@ -559,7 +559,7 @@ impl DefPathData {
559559
GlobalMetaData(name) => {
560560
return name
561561
}
562-
// note that this does not show up in user printouts
562+
// Note that this does not show up in user print-outs.
563563
CrateRoot => sym::double_braced_crate,
564564
Impl => sym::double_braced_impl,
565565
Misc => sym::double_braced_misc,

src/librustc/hir/map/mod.rs

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use self::collector::NodeCollector;
22
pub use self::def_collector::{DefCollector, MacroInvocationData};
3-
pub use self::definitions::{Definitions, DefKey, DefPath, DefPathData,
4-
DisambiguatedDefPathData, DefPathHash};
3+
pub use self::definitions::{
4+
Definitions, DefKey, DefPath, DefPathData, DisambiguatedDefPathData, DefPathHash
5+
};
56

67
use crate::dep_graph::{DepGraph, DepNode, DepKind, DepNodeIndex};
78

@@ -238,7 +239,7 @@ impl<'hir> Map<'hir> {
238239
})
239240
}
240241

241-
// FIXME(@ljedrz): replace the NodeId variant
242+
// FIXME(@ljedrz): replace the `NodeId` variant.
242243
#[inline]
243244
pub fn local_def_id_from_hir_id(&self, hir_id: HirId) -> DefId {
244245
self.opt_local_def_id_from_hir_id(hir_id).unwrap_or_else(|| {
@@ -247,7 +248,7 @@ impl<'hir> Map<'hir> {
247248
})
248249
}
249250

250-
// FIXME(@ljedrz): replace the NodeId variant
251+
// FIXME(@ljedrz): replace the `NodeId` variant.
251252
#[inline]
252253
pub fn opt_local_def_id_from_hir_id(&self, hir_id: HirId) -> Option<DefId> {
253254
let node_id = self.hir_to_node_id(hir_id);
@@ -264,7 +265,7 @@ impl<'hir> Map<'hir> {
264265
self.definitions.as_local_node_id(def_id)
265266
}
266267

267-
// FIXME(@ljedrz): replace the NodeId variant
268+
// FIXME(@ljedrz): replace the `NodeId` variant.
268269
#[inline]
269270
pub fn as_local_hir_id(&self, def_id: DefId) -> Option<HirId> {
270271
self.definitions.as_local_hir_id(def_id)
@@ -426,7 +427,7 @@ impl<'hir> Map<'hir> {
426427
self.fn_decl_by_hir_id(hir_id)
427428
}
428429

429-
// FIXME(@ljedrz): replace the NodeId variant
430+
// FIXME(@ljedrz): replace the `NodeId` variant.
430431
pub fn fn_decl_by_hir_id(&self, hir_id: HirId) -> Option<FnDecl> {
431432
if let Some(entry) = self.find_entry(hir_id) {
432433
entry.fn_decl().cloned()
@@ -455,7 +456,7 @@ impl<'hir> Map<'hir> {
455456
self.maybe_body_owned_by_by_hir_id(hir_id)
456457
}
457458

458-
// FIXME(@ljedrz): replace the NodeId variant
459+
// FIXME(@ljedrz): replace the `NodeId` variant.
459460
pub fn maybe_body_owned_by_by_hir_id(&self, hir_id: HirId) -> Option<BodyId> {
460461
if let Some(entry) = self.find_entry(hir_id) {
461462
if self.dep_graph.is_fully_enabled() {
@@ -483,7 +484,7 @@ impl<'hir> Map<'hir> {
483484
self.body_owner_kind_by_hir_id(hir_id)
484485
}
485486

486-
// FIXME(@ljedrz): replace the NodeId variant
487+
// FIXME(@ljedrz): replace the `NodeId` variant.
487488
pub fn body_owner_kind_by_hir_id(&self, id: HirId) -> BodyOwnerKind {
488489
match self.get_by_hir_id(id) {
489490
Node::Item(&Item { node: ItemKind::Const(..), .. }) |
@@ -587,14 +588,13 @@ impl<'hir> Map<'hir> {
587588
}
588589
}
589590

590-
/// Retrieve the Node corresponding to `id`, panicking if it cannot
591-
/// be found.
591+
/// Retrieves the `Node` corresponding to `id`, panicking if it cannot be found.
592592
pub fn get(&self, id: NodeId) -> Node<'hir> {
593593
let hir_id = self.node_to_hir_id(id);
594594
self.get_by_hir_id(hir_id)
595595
}
596596

597-
// FIXME(@ljedrz): replace the NodeId variant
597+
// FIXME(@ljedrz): replace the `NodeId` variant.
598598
pub fn get_by_hir_id(&self, id: HirId) -> Node<'hir> {
599599
// read recorded by `find`
600600
self.find_by_hir_id(id).unwrap_or_else(||
@@ -634,7 +634,7 @@ impl<'hir> Map<'hir> {
634634
self.find_by_hir_id(hir_id)
635635
}
636636

637-
// FIXME(@ljedrz): replace the NodeId variant
637+
// FIXME(@ljedrz): replace the `NodeId` variant.
638638
pub fn find_by_hir_id(&self, hir_id: HirId) -> Option<Node<'hir>> {
639639
let result = self.find_entry(hir_id).and_then(|entry| {
640640
if let Node::Crate = entry.node {
@@ -665,7 +665,7 @@ impl<'hir> Map<'hir> {
665665
self.hir_to_node_id(parent_hir_id)
666666
}
667667

668-
// FIXME(@ljedrz): replace the NodeId variant
668+
// FIXME(@ljedrz): replace the `NodeId` variant.
669669
pub fn get_parent_node_by_hir_id(&self, hir_id: HirId) -> HirId {
670670
if self.dep_graph.is_fully_enabled() {
671671
let hir_id_owner = hir_id.owner;
@@ -721,24 +721,24 @@ impl<'hir> Map<'hir> {
721721
{
722722
let mut id = start_id;
723723
loop {
724-
let parent_node = self.get_parent_node_by_hir_id(id);
725-
if parent_node == CRATE_HIR_ID {
724+
let parent_id = self.get_parent_node_by_hir_id(id);
725+
if parent_id == CRATE_HIR_ID {
726726
return Ok(CRATE_HIR_ID);
727727
}
728-
if parent_node == id {
728+
if parent_id == id {
729729
return Err(id);
730730
}
731731

732-
if let Some(entry) = self.find_entry(parent_node) {
732+
if let Some(entry) = self.find_entry(parent_id) {
733733
if let Node::Crate = entry.node {
734734
return Err(id);
735735
}
736736
if found(&entry.node) {
737-
return Ok(parent_node);
737+
return Ok(parent_id);
738738
} else if bail_early(&entry.node) {
739-
return Err(parent_node);
739+
return Err(parent_id);
740740
}
741-
id = parent_node;
741+
id = parent_id;
742742
} else {
743743
return Err(id);
744744
}
@@ -803,7 +803,7 @@ impl<'hir> Map<'hir> {
803803
self.hir_to_node_id(parent_hir_id)
804804
}
805805

806-
// FIXME(@ljedrz): replace the NodeId variant
806+
// FIXME(@ljedrz): replace the `NodeId` variant.
807807
pub fn get_parent_item(&self, hir_id: HirId) -> HirId {
808808
match self.walk_parent_nodes(hir_id, |node| match *node {
809809
Node::Item(_) |
@@ -824,7 +824,7 @@ impl<'hir> Map<'hir> {
824824
self.get_module_parent_by_hir_id(hir_id)
825825
}
826826

827-
// FIXME(@ljedrz): replace the NodeId variant
827+
// FIXME(@ljedrz): replace the `NodeId` variant.
828828
pub fn get_module_parent_by_hir_id(&self, id: HirId) -> DefId {
829829
self.local_def_id_from_hir_id(self.get_module_parent_node(id))
830830
}
@@ -861,7 +861,7 @@ impl<'hir> Map<'hir> {
861861
self.get_parent_did_by_hir_id(hir_id)
862862
}
863863

864-
// FIXME(@ljedrz): replace the NodeId variant
864+
// FIXME(@ljedrz): replace the `NodeId` variant.
865865
pub fn get_parent_did_by_hir_id(&self, id: HirId) -> DefId {
866866
self.local_def_id_from_hir_id(self.get_parent_item(id))
867867
}
@@ -871,7 +871,7 @@ impl<'hir> Map<'hir> {
871871
self.get_foreign_abi_by_hir_id(hir_id)
872872
}
873873

874-
// FIXME(@ljedrz): replace the NodeId variant
874+
// FIXME(@ljedrz): replace the `NodeId` variant.
875875
pub fn get_foreign_abi_by_hir_id(&self, hir_id: HirId) -> Abi {
876876
let parent = self.get_parent_item(hir_id);
877877
if let Some(entry) = self.find_entry(parent) {
@@ -890,7 +890,7 @@ impl<'hir> Map<'hir> {
890890
self.expect_item_by_hir_id(hir_id)
891891
}
892892

893-
// FIXME(@ljedrz): replace the NodeId variant
893+
// FIXME(@ljedrz): replace the `NodeId` variant.
894894
pub fn expect_item_by_hir_id(&self, id: HirId) -> &'hir Item {
895895
match self.find_by_hir_id(id) { // read recorded by `find`
896896
Some(Node::Item(item)) => item,
@@ -946,7 +946,7 @@ impl<'hir> Map<'hir> {
946946
self.expect_expr_by_hir_id(hir_id)
947947
}
948948

949-
// FIXME(@ljedrz): replace the NodeId variant
949+
// FIXME(@ljedrz): replace the `NodeId` variant.
950950
pub fn expect_expr_by_hir_id(&self, id: HirId) -> &'hir Expr {
951951
match self.find_by_hir_id(id) { // read recorded by find
952952
Some(Node::Expr(expr)) => expr,
@@ -960,7 +960,7 @@ impl<'hir> Map<'hir> {
960960
self.name_by_hir_id(hir_id)
961961
}
962962

963-
// FIXME(@ljedrz): replace the NodeId variant
963+
// FIXME(@ljedrz): replace the `NodeId` variant.
964964
pub fn name_by_hir_id(&self, id: HirId) -> Name {
965965
match self.get_by_hir_id(id) {
966966
Node::Item(i) => i.ident.name,
@@ -977,14 +977,14 @@ impl<'hir> Map<'hir> {
977977
}
978978
}
979979

980-
/// Given a node ID, get a list of attributes associated with the AST
981-
/// corresponding to the Node ID
980+
/// Given a node ID, gets a list of attributes associated with the AST
981+
/// corresponding to the node-ID.
982982
pub fn attrs(&self, id: NodeId) -> &'hir [ast::Attribute] {
983983
let hir_id = self.node_to_hir_id(id);
984984
self.attrs_by_hir_id(hir_id)
985985
}
986986

987-
// FIXME(@ljedrz): replace the NodeId variant
987+
// FIXME(@ljedrz): replace the `NodeId` variant.
988988
pub fn attrs_by_hir_id(&self, id: HirId) -> &'hir [ast::Attribute] {
989989
self.read(id); // reveals attributes on the node
990990
let attrs = match self.find_entry(id).map(|entry| entry.node) {
@@ -1053,7 +1053,7 @@ impl<'hir> Map<'hir> {
10531053
self.span_by_hir_id(hir_id)
10541054
}
10551055

1056-
// FIXME(@ljedrz): replace the NodeId variant
1056+
// FIXME(@ljedrz): replace the `NodeId` variant.
10571057
pub fn span_by_hir_id(&self, hir_id: HirId) -> Span {
10581058
self.read(hir_id); // reveals span from node
10591059
match self.find_entry(hir_id).map(|entry| entry.node) {
@@ -1101,7 +1101,7 @@ impl<'hir> Map<'hir> {
11011101
hir_id_to_string(self, self.node_to_hir_id(id), true)
11021102
}
11031103

1104-
// FIXME(@ljedrz): replace the NodeId variant
1104+
// FIXME(@ljedrz): replace the `NodeId` variant.
11051105
pub fn hir_to_string(&self, id: HirId) -> String {
11061106
hir_id_to_string(self, id, true)
11071107
}
@@ -1110,7 +1110,7 @@ impl<'hir> Map<'hir> {
11101110
hir_id_to_string(self, self.node_to_hir_id(id), false)
11111111
}
11121112

1113-
// FIXME(@ljedrz): replace the NodeId variant
1113+
// FIXME(@ljedrz): replace the `NodeId` variant.
11141114
pub fn hir_to_user_string(&self, id: HirId) -> String {
11151115
hir_id_to_string(self, id, false)
11161116
}
@@ -1119,7 +1119,7 @@ impl<'hir> Map<'hir> {
11191119
print::to_string(self, |s| s.print_node(self.get(id)))
11201120
}
11211121

1122-
// FIXME(@ljedrz): replace the NodeId variant
1122+
// FIXME(@ljedrz): replace the `NodeId` variant.
11231123
pub fn hir_to_pretty_string(&self, id: HirId) -> String {
11241124
print::to_string(self, |s| s.print_node(self.get_by_hir_id(id)))
11251125
}
@@ -1451,8 +1451,9 @@ pub fn provide(providers: &mut Providers<'_>) {
14511451
if let Some(node_id) = tcx.hir().as_local_node_id(def_id) {
14521452
tcx.hir().def_kind(node_id)
14531453
} else {
1454-
bug!("Calling local def_kind query provider for upstream DefId: {:?}",
1455-
def_id)
1454+
bug!("calling local def_kind query provider for upstream DefId: {:?}",
1455+
def_id
1456+
);
14561457
}
14571458
};
14581459
}

0 commit comments

Comments
 (0)