impl Index {
pub fn new(max_index: usize) -> Index {
- Index {
- positions: vec![u32::MAX; max_index]
- }
+ Index { positions: vec![u32::MAX; max_index] }
}
pub fn record(&mut self, def_id: DefId, entry: Lazy<Entry>) {
assert!(self.positions[item] == u32::MAX,
"recorded position for item {:?} twice, first at {:?} and now at {:?}",
- item, self.positions[item], position);
+ item,
+ self.positions[item],
+ position);
self.positions[item] = position.to_le();
}
let index = def_index.as_usize();
debug!("Index::lookup: index={:?} words.len={:?}",
- index, words.len());
+ index,
+ words.len());
let position = u32::from_le(words[index]);
if position == u32::MAX {
}
}
- pub fn iter_enumerated<'a>(&self, bytes: &'a [u8])
- -> impl Iterator<Item=(DefIndex, Lazy<Entry<'tcx>>)> + 'a {
+ pub fn iter_enumerated<'a>(&self,
+ bytes: &'a [u8])
+ -> impl Iterator<Item = (DefIndex, Lazy<Entry<'tcx>>)> + 'a {
let words = &bytes_to_words(&bytes[self.position..])[..self.len];
words.iter().enumerate().filter_map(|(index, &position)| {
if position == u32::MAX {