mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 10:22:12 +02:00
Remove unused Index(Mut)
impls on AST types (#11903)
# Description Both `Block` and `Pipeline` had `Index`/`IndexMut` implementations to access their elements, that are currently unused. Explicit helpers or iteration would generally be preferred anyways but in the current state the inner containers are `pub` and are liberally used. (Sometimes with potentially panicking indexing or also iteration) As it is potentially unclear what the meaning of the element from a block or pipeline queried by a usize is, let's remove it entirely until we come up with a better API. # User-Facing Changes None Plugin authors shouldn't dig into AST internals
This commit is contained in:
committed by
GitHub
parent
b23fe30530
commit
6e590fe0a2
@@ -19,9 +19,9 @@ pub fn do_test(test: &[u8], expected: &str, error_contains: Option<&str>) {
|
||||
match working_set.parse_errors.first() {
|
||||
None => {
|
||||
assert_eq!(block.len(), 1);
|
||||
let expressions = &block[0];
|
||||
let expressions = &block.pipelines[0];
|
||||
assert_eq!(expressions.len(), 1);
|
||||
if let PipelineElement::Expression(_, expr) = &expressions[0] {
|
||||
if let PipelineElement::Expression(_, expr) = &expressions.elements[0] {
|
||||
assert_eq!(expr.expr, Expr::String(expected.to_string()))
|
||||
} else {
|
||||
panic!("Not an expression")
|
||||
|
Reference in New Issue
Block a user