summaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/scanner.rs9
-rw-r--r--src/parse/tokens.rs6
2 files changed, 8 insertions, 7 deletions
diff --git a/src/parse/scanner.rs b/src/parse/scanner.rs
index bb827255..f893c4d3 100644
--- a/src/parse/scanner.rs
+++ b/src/parse/scanner.rs
@@ -128,9 +128,10 @@ impl<'s> Scanner<'s> {
/// The remaining source string after the current index.
#[inline]
pub fn rest(&self) -> &'s str {
- // SAFETY: The index is always in bounds and on a codepoint boundary
- // since it is:
- // - either increased by the length of a scanned character,
+ // Safety: The index is always in bounds and on a codepoint boundary
+ // since it starts at zero and is is:
+ // - either increased by the length of a scanned character, advacing
+ // from one codepoint boundary to the next,
// - or checked upon jumping.
unsafe { self.src.get_unchecked(self.index ..) }
}
@@ -138,7 +139,7 @@ impl<'s> Scanner<'s> {
/// The full source string up to the current index.
#[inline]
pub fn eaten(&self) -> &'s str {
- // SAFETY: The index is always okay, for details see `rest()`.
+ // Safety: The index is always okay, for details see `rest()`.
unsafe { self.src.get_unchecked(.. self.index) }
}
diff --git a/src/parse/tokens.rs b/src/parse/tokens.rs
index 9fd13ecc..acd939e8 100644
--- a/src/parse/tokens.rs
+++ b/src/parse/tokens.rs
@@ -595,9 +595,9 @@ mod tests {
// Test with each applicable suffix.
for &(block, mode, suffix, token) in SUFFIXES {
let src = $src;
- #[allow(unused)]
- let mut blocks = BLOCKS;
- $(blocks = $blocks;)?
+ #[allow(unused_variables)]
+ let blocks = BLOCKS;
+ $(let blocks = $blocks;)?
assert!(!blocks.contains(|c| !BLOCKS.contains(c)));
if (mode.is_none() || mode == Some($mode)) && blocks.contains(block) {
t!(@$mode: format!("{}{}", src, suffix) => $($token,)* token);