Skip to content

Commit 0e57cf7

Browse files
committed
push returns index
1 parent 07bd34f commit 0e57cf7

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

crates/utils/src/gsym.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ fn get_or_intern(pool: &Pool, s: &str) -> u32 {
1616
let idx = pool.iter().position(|(_, x)| x == s);
1717
match idx {
1818
Some(idx) => idx as u32,
19-
None => {
20-
let idx = pool.count();
21-
pool.push(s.to_owned());
22-
idx as u32
23-
}
19+
None => pool.push(s.to_owned()) as u32,
2420
}
2521
}
2622

crates/utils/src/position.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ where
5252
/// Add a file to the database, returning the handle that can be used to
5353
/// refer to it again.
5454
pub fn add(&self, name: Name, source: Source) -> usize {
55-
let file_id = self.files.count();
56-
self.files.push(files::SimpleFile::new(name, source));
57-
file_id
55+
self.files.push(files::SimpleFile::new(name, source))
5856
}
5957

6058
/// Get the file corresponding to the given id.

0 commit comments

Comments
 (0)