mirror of
https://github.com/nushell/nushell.git
synced 2025-07-08 02:17:22 +02:00
* Clippy fixes * Finish converting to use clippy * fix warnings in new master * fix windows * fix windows Co-authored-by: Artem Vorotnikov <artem@vorotnikov.me>
37 lines
887 B
Rust
37 lines
887 B
Rust
#![allow(unused)]
|
|
|
|
pub(crate) mod color_trace;
|
|
pub(crate) mod expand_trace;
|
|
|
|
pub(crate) use self::color_trace::*;
|
|
pub(crate) use self::expand_trace::*;
|
|
|
|
use crate::hir::tokens_iterator::TokensIteratorState;
|
|
use nu_source::{PrettyDebug, PrettyDebugWithSource, Text};
|
|
|
|
#[derive(Debug)]
|
|
pub(crate) enum DebugIteratorToken {
|
|
Seen(String),
|
|
Unseen(String),
|
|
Cursor,
|
|
}
|
|
|
|
pub(crate) fn debug_tokens(state: &TokensIteratorState, source: &str) -> Vec<DebugIteratorToken> {
|
|
let mut out = vec![];
|
|
|
|
for (i, token) in state.tokens.iter().enumerate() {
|
|
if state.index == i {
|
|
out.push(DebugIteratorToken::Cursor);
|
|
}
|
|
|
|
let msg = token.debug(source).to_string();
|
|
if state.seen.contains(&i) {
|
|
out.push(DebugIteratorToken::Seen(msg));
|
|
} else {
|
|
out.push(DebugIteratorToken::Unseen(msg));
|
|
}
|
|
}
|
|
|
|
out
|
|
}
|