chore: create alias String.Slice.any for String.Slice.contains (#11282)

This PR adds the alias `String.Slice.any` for `String.Slice.contains`.

It would probably be even better to only have one, but we don't have a
good mechanism for pointing people looking for one towards the other, so
an alias it is for now.
This commit is contained in:
Markus Himmel 2025-11-20 14:21:30 +01:00 committed by GitHub
parent 2c12bc9fdf
commit cf0e4441e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -509,6 +509,10 @@ def contains [ToForwardSearcher ρ σ] (s : Slice) (pat : ρ) : Bool :=
let searcher := ToForwardSearcher.toSearcher s pat
searcher.any (· matches .matched ..)
@[inline, inherit_doc contains]
def any [ToForwardSearcher ρ σ] (s : Slice) (pat : ρ) : Bool :=
s.contains pat
/--
Checks whether a slice only consists of matches of the pattern {name}`pat` anywhere.