]> git.lizzy.rs Git - rust.git/blobdiff - crates/tt/src/lib.rs
minor: dead code
[rust.git] / crates / tt / src / lib.rs
index 9d9a01e30a9a2d821a0f1294cfc47a345d7ef80c..b2841370ec59d9b676622959ee58010964e90f91 100644 (file)
@@ -88,7 +88,7 @@ pub struct Ident {
 }
 
 fn print_debug_subtree(f: &mut fmt::Formatter<'_>, subtree: &Subtree, level: usize) -> fmt::Result {
-    let align = std::iter::repeat("  ").take(level).collect::<String>();
+    let align = "  ".repeat(level);
 
     let aux = match subtree.delimiter.map(|it| (it.kind, it.id.0)) {
         None => "$".to_string(),
@@ -113,7 +113,7 @@ fn print_debug_subtree(f: &mut fmt::Formatter<'_>, subtree: &Subtree, level: usi
 }
 
 fn print_debug_token(f: &mut fmt::Formatter<'_>, tkn: &TokenTree, level: usize) -> fmt::Result {
-    let align = std::iter::repeat("  ").take(level).collect::<String>();
+    let align = "  ".repeat(level);
 
     match tkn {
         TokenTree::Leaf(leaf) => match leaf {
@@ -239,9 +239,8 @@ pub fn as_debug_string(&self) -> String {
 
         let mut res = String::new();
         res.push_str(delim.0);
-        let mut iter = self.token_trees.iter();
         let mut last = None;
-        while let Some(child) = iter.next() {
+        for child in &self.token_trees {
             let s = match child {
                 TokenTree::Leaf(it) => {
                     let s = match it {
@@ -278,8 +277,6 @@ pub fn as_debug_string(&self) -> String {
 
 #[derive(Debug, PartialEq, Eq, Clone)]
 pub enum ExpansionError {
-    IOError(String),
-    JsonError(String),
     Unknown(String),
     ExpansionError(String),
 }
@@ -287,8 +284,6 @@ pub enum ExpansionError {
 impl fmt::Display for ExpansionError {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match self {
-            ExpansionError::IOError(e) => write!(f, "I/O error: {}", e),
-            ExpansionError::JsonError(e) => write!(f, "JSON decoding error: {}", e),
             ExpansionError::Unknown(e) => e.fmt(f),
             ExpansionError::ExpansionError(e) => write!(f, "proc macro returned error: {}", e),
         }