Skip to content

return Option instead of assert!/fail! #15535

Closed
@lucidd

Description

@lucidd

There are quite a few functions on traits for slices that fail when given out of bounds parameters rather than returning an Option.

  • slice
  • slice_to
  • slice_from
  • slice_chars
  • tail
  • tailn
  • subslice_offset
  • char_range_at
  • char_range_at_reverse
  • char_at
  • char_at_reverse

There are probably a lot more functions that could change to Option rather than fail but those are the ones i found so far.
If this is something we would want to change, i would offer myself to work on that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions