Repository: nushell/nushell
File: crates/nu-command/src/filters/drop/nth.rs (Rust)

Code before:
                                input: "value originates from here".into(),
                                msg_span: head,
                                input_span: value.span(),
                            });
                        }

                        match range.end() {
                            Bound::Included(end) => {
                                if end < start {
                                    return Err(ShellError::UnsupportedInput {
                                    msg: "The upper bound must be greater than or equal to the lower bound".into(),
                                    input: "value originates from here".into(),
                                    msg_span: head,
                                    input_span: value.span(),
                                });
                                }

                                let end = if let PipelineData::Value(Value::List { vals, .. }, _) =
                                    &input
                                {
                                    end.min((vals.len() as i64) - 1)
                                } else {
                                    end
                                };

                                rows_to_drop.extend((start as usize)..=(end as usize));
                            }
                            Bound::Excluded(end) => {
                                if end <= start {
                                    return Err(ShellError::UnsupportedInput {
                                        msg: "The upper bound must be greater than the lower bound"
                                            .into(),
                                        input: "value originates from here".into(),
                                        msg_span: head,
                                        input_span: value.span(),
                                    });
                                }

                                let end = if let PipelineData::Value(Value::List { vals, .. }, _) =
                                    &input
                                {
                                    (end - 1).min((vals.len() as i64) - 1)
                                } else {
                                    end - 1
                                };

                                rows_to_drop.extend((start as usize)..=(end as usize));
                            }
                            Bound::Unbounded => {
                                let start_usize = start as usize;
                                min_unbounded_start = Some(

Review comment (suggestion):
this code path shouldn't be necessary, `DropNthIterator` handles the case where the input last has fewer rows than `rows_to_drop`

```suggestion
                                rows_to_drop.extend((start as usize)..=(end as usize));
```

Code after:
    }
}

fn get_rows_to_drop(
    args: &[Value],
    head: Span,
) -> Result<(VecDeque<usize>, Option<usize>), ShellError> {
    let mut rows_to_drop = Vec::new();
    let mut min_unbounded_start: Option<usize> = None;

    for value in args {
        if let Ok(i) = value.as_int() {
            if i < 0 {
                return Err(ShellError::UnsupportedInput {
                    msg: "drop nth accepts only positive ints".into(),
                    input: "value originates from here".into(),
                    msg_span: head,
                    input_span: value.span(),
                });
            }
            rows_to_drop.push(i as usize);
        } else if let Ok(range) = value.as_range() {
            match range {
                Range::IntRange(range) => {
                    let start = range.start();
                    if start < 0 {
                        return Err(ShellError::UnsupportedInput {
                            msg: "drop nth accepts only positive ints".into(),
                            input: "value originates from here".into(),
                            msg_span: head,
                            input_span: value.span(),
                        });
                    }

                    match range.end() {
                        Bound::Included(end) => {
                            if end < start {
                                return Err(ShellError::UnsupportedInput {
                                    msg: "The upper bound must be greater than or equal to the lower bound".into(),
                                    input: "value originates from here".into(),
                                    msg_span: head,
                                    input_span: value.span(),
                                });
                            }
                            rows_to_drop.extend((start as usize)..=(end as usize));
                        }
                        Bound::Excluded(end) => {
                            if end <= start {
                                return Err(ShellError::UnsupportedInput {
                                    msg: "The upper bound must be greater than the lower bound"
                                        .into(),