From 3b2ba59526f8e524aa3c1526dda2828a93653ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Wed, 7 Nov 2018 11:58:34 +0100 Subject: Use ArrayString instead of hand rolled data structure --- crates/ra_syntax/src/utils.rs | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'crates/ra_syntax/src/utils.rs') diff --git a/crates/ra_syntax/src/utils.rs b/crates/ra_syntax/src/utils.rs index 5bef4a639..cad9544be 100644 --- a/crates/ra_syntax/src/utils.rs +++ b/crates/ra_syntax/src/utils.rs @@ -1,6 +1,5 @@ use crate::{File, SyntaxKind, SyntaxNodeRef, WalkEvent}; use std::fmt::Write; -use std::ops::Deref; use std::str; /// Parse a file and create a string representation of the resulting parse tree. @@ -80,38 +79,3 @@ pub(crate) fn validate_block_structure(root: SyntaxNodeRef) { } } } - -#[derive(Debug)] -pub struct MutAsciiString<'a> { - buf: &'a mut [u8], - len: usize, -} - -impl<'a> MutAsciiString<'a> { - pub fn new(buf: &'a mut [u8]) -> MutAsciiString<'a> { - MutAsciiString { buf, len: 0 } - } - - pub fn as_str(&self) -> &str { - str::from_utf8(&self.buf[..self.len]).unwrap() - } - - pub fn len(&self) -> usize { - self.len - } - - pub fn push(&mut self, c: char) { - assert!(self.len() < self.buf.len()); - assert!(c.is_ascii()); - - self.buf[self.len] = c as u8; - self.len += 1; - } -} - -impl<'a> Deref for MutAsciiString<'a> { - type Target = str; - fn deref(&self) -> &str { - self.as_str() - } -} -- cgit v1.2.3