mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 01:54:57 +02:00
Remove unused Display implementations
After the previous commit, nushell uses PrettyDebug and PrettyDebugWithSource for our pretty-printed display output. PrettyDebug produces a structured `pretty.rs` document rather than writing directly into a fmt::Formatter, and types that implement `PrettyDebug` have a convenience `display` method that produces a string (to be used in situations where `Display` is needed for compatibility with other traits, or where simple rendering is appropriate).
This commit is contained in:
@ -10,8 +10,8 @@ use crate::TaggedDictBuilder;
|
||||
use indexmap::IndexMap;
|
||||
use log::trace;
|
||||
use nu_source::Text;
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Scope {
|
||||
it: Value,
|
||||
vars: IndexMap<String, Value>,
|
||||
@ -26,15 +26,6 @@ impl Scope {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Scope {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_map()
|
||||
.entry(&"$it", &format!("{:?}", self.it.value))
|
||||
.entries(self.vars.iter().map(|(k, v)| (k, &v.value)))
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl Scope {
|
||||
pub(crate) fn empty() -> Scope {
|
||||
Scope {
|
||||
@ -177,7 +168,7 @@ fn evaluate_reference(
|
||||
source: &Text,
|
||||
tag: Tag,
|
||||
) -> Result<Value, ShellError> {
|
||||
trace!("Evaluating {} with Scope {}", name, scope);
|
||||
trace!("Evaluating {:?} with Scope {:?}", name, scope);
|
||||
match name {
|
||||
hir::Variable::It(_) => Ok(scope.it.value.clone().into_value(tag)),
|
||||
hir::Variable::Other(inner) => match inner.slice(source) {
|
||||
|
Reference in New Issue
Block a user