forked from extern/nushell
Syntax cleaning bit.
This commit is contained in:
parent
8ac36e0e83
commit
193b8dbe20
@ -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
|
if field {
|
||||||
].iter()
|
|
||||||
.fold(0, |acc, &field| {
|
|
||||||
if field {
|
|
||||||
acc + 1
|
acc + 1
|
||||||
} else {
|
} else {
|
||||||
acc
|
acc
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_valid(&self) -> bool {
|
fn is_valid(&self) -> bool {
|
||||||
@ -57,7 +55,7 @@ impl Str {
|
|||||||
fn for_input(&mut self, field: String) {
|
fn for_input(&mut self, field: String) {
|
||||||
self.field = Some(field);
|
self.field = Some(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn for_to_int(&mut self) {
|
fn for_to_int(&mut self) {
|
||||||
self.int = true;
|
self.int = true;
|
||||||
|
|
||||||
@ -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 New Issue
Block a user