Skip to content

Range slicing operations return whole value instead of empty list when using range 0..<0 #14769

Closed
@132ikl

Description

Describe the bug

When passed a range containing no elements, for non-zero cases str substring behaves correctly:

"hello world" | str substring 1..<1
# =>

but if the range is 0..<0, it returns the whole string instead

"hello world" | str substring 0..<0
# => hello world

How to reproduce

  1. "hello world" | str substring 0..<0

Expected behavior

I expected str substring to return an empty string on str substring 0..<0

Configuration

key value
version 0.101.1
major 0
minor 101
patch 1
branch makepkg
commit_hash 9ed2ca7
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.81.0 (eeb90cda1 2024-09-04)
rust_channel 1.81.0-x86_64-unknown-linux-gnu
cargo_version cargo 1.81.0 (2dbb1af80 2024-08-20)
build_time 2025-01-06 22:37:09 +00:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash
installed_plugins custom_values 0.1.0, example 0.101.1, formats 0.101.1, gstat 0.101.1, inc 0.101.1, polars 0.101.1, query 0.101.1, stress_internals 0.101.1

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't workinginconsistent-behaviorBehavior between different commands or types inconsistent/unexpectedpanic

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions