mirror of
https://github.com/nushell/nushell
synced 2025-01-28 04:45:18 +00:00
Syntax cleaning bit.
This commit is contained in:
parent
8ac36e0e83
commit
193b8dbe20
1 changed files with 8 additions and 13 deletions
|
@ -24,18 +24,16 @@ impl Str {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fields(&self) -> u8 {
|
fn fields(&self) -> u8 {
|
||||||
[
|
[self.downcase, self.upcase, self.int].iter().fold(
|
||||||
self.downcase,
|
0,
|
||||||
self.upcase,
|
|acc, &field| {
|
||||||
self.int
|
|
||||||
].iter()
|
|
||||||
.fold(0, |acc, &field| {
|
|
||||||
if field {
|
if field {
|
||||||
acc + 1
|
acc + 1
|
||||||
} else {
|
} else {
|
||||||
acc
|
acc
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_valid(&self) -> bool {
|
fn is_valid(&self) -> bool {
|
||||||
|
@ -265,10 +263,7 @@ mod tests {
|
||||||
|
|
||||||
fn sample_record(key: &str, value: &str) -> Spanned<Value> {
|
fn sample_record(key: &str, value: &str) -> Spanned<Value> {
|
||||||
let mut record = SpannedDictBuilder::new(Span::unknown());
|
let mut record = SpannedDictBuilder::new(Span::unknown());
|
||||||
record.insert(
|
record.insert(key.clone(), Value::string(value));
|
||||||
key.clone(),
|
|
||||||
Value::string(value),
|
|
||||||
);
|
|
||||||
record.into_spanned_value()
|
record.into_spanned_value()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue