summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-06-06 19:06:56 +0200
committerLaurenz <laurmaedje@gmail.com>2023-06-06 19:06:56 +0200
commit219f14355b5df9a93210895d47f77b028291e788 (patch)
tree1d1a0549a3b49125ea7cd054cfc2e10b4c222c7b
parentf453565ebf061581f398eb3a5dcfb7a35a5ad04a (diff)
Rename `into_u16` to `as_u16`
-rw-r--r--cli/src/main.rs2
-rw-r--r--docs/src/html.rs2
-rw-r--r--src/syntax/source.rs2
-rw-r--r--src/syntax/span.rs2
-rw-r--r--tests/src/tests.rs4
5 files changed, 6 insertions, 6 deletions
diff --git a/cli/src/main.rs b/cli/src/main.rs
index 09ba0515..d0cf6139 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -570,7 +570,7 @@ impl World for SystemWorld {
}
fn source(&self, id: SourceId) -> &Source {
- &self.sources[id.into_u16() as usize]
+ &self.sources[id.as_u16() as usize]
}
fn book(&self) -> &Prehashed<FontBook> {
diff --git a/docs/src/html.rs b/docs/src/html.rs
index 5363d1b2..78a43511 100644
--- a/docs/src/html.rs
+++ b/docs/src/html.rs
@@ -478,7 +478,7 @@ impl World for DocWorld {
}
fn source(&self, id: SourceId) -> &Source {
- assert_eq!(id.into_u16(), 0, "invalid source id");
+ assert_eq!(id.as_u16(), 0, "invalid source id");
&self.0
}
diff --git a/src/syntax/source.rs b/src/syntax/source.rs
index f67ed656..277271db 100644
--- a/src/syntax/source.rs
+++ b/src/syntax/source.rs
@@ -282,7 +282,7 @@ impl SourceId {
}
/// Extract the underlying number.
- pub const fn into_u16(self) -> u16 {
+ pub const fn as_u16(self) -> u16 {
self.0
}
}
diff --git a/src/syntax/span.rs b/src/syntax/span.rs
index 0e4ec215..91e0a3cf 100644
--- a/src/syntax/span.rs
+++ b/src/syntax/span.rs
@@ -56,7 +56,7 @@ impl Span {
/// Pack the components into a span.
#[track_caller]
const fn pack(id: SourceId, number: u64) -> Span {
- let bits = ((id.into_u16() as u64) << Self::BITS) | number;
+ let bits = ((id.as_u16() as u64) << Self::BITS) | number;
match NonZeroU64::new(bits) {
Some(v) => Self(v),
None => panic!("span encoding is zero"),
diff --git a/tests/src/tests.rs b/tests/src/tests.rs
index 61414daa..2c94af6c 100644
--- a/tests/src/tests.rs
+++ b/tests/src/tests.rs
@@ -279,7 +279,7 @@ impl World for TestWorld {
}
fn source(&self, id: SourceId) -> &Source {
- &self.sources[id.into_u16() as usize]
+ &self.sources[id.as_u16() as usize]
}
fn book(&self) -> &Prehashed<FontBook> {
@@ -307,7 +307,7 @@ impl TestWorld {
let slot = self.slot(path);
let id = if let Some(&Ok(id)) = slot.source.get() {
drop(slot);
- self.sources.as_mut()[id.into_u16() as usize].replace(text);
+ self.sources.as_mut()[id.as_u16() as usize].replace(text);
id
} else {
let id = self.insert(path, text);