Skip to content

Commit 6ba3a2c

Browse files
committed
Remove obsolete constants and backticks
1 parent 5db19db commit 6ba3a2c

File tree

1 file changed

+31
-34
lines changed

1 file changed

+31
-34
lines changed

library/src/scala/collection/StringOps.scala

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ import scala.util.matching.Regex
2626
object StringOps {
2727
// just statics for companion class.
2828
private final val LF = 0x0A
29-
private final val FF = 0x0C
3029
private final val CR = 0x0D
31-
private final val SU = 0x1A
3230

3331
private class StringIterator(private[this] val s: String) extends AbstractIterator[Char] {
3432
private[this] var pos = 0
@@ -180,14 +178,14 @@ object StringOps {
180178
final class StringOps(private val s: String) extends AnyVal {
181179
import StringOps._
182180

183-
@`inline` def view: StringView = new StringView(s)
181+
@inline def view: StringView = new StringView(s)
184182

185-
@`inline` def size: Int = s.length
183+
@inline def size: Int = s.length
186184

187-
@`inline` def knownSize: Int = s.length
185+
@inline def knownSize: Int = s.length
188186

189187
/** Get the char at the specified index. */
190-
@`inline` def apply(i: Int): Char = s.charAt(i)
188+
@inline def apply(i: Int): Char = s.charAt(i)
191189

192190
def sizeCompare(otherSize: Int): Int = Integer.compare(s.length, otherSize)
193191

@@ -344,13 +342,13 @@ final class StringOps(private val s: String) extends AnyVal {
344342
* @return a new string which contains all chars
345343
* of this string followed by all chars of `suffix`.
346344
*/
347-
@`inline` def concat(suffix: String): String = s + suffix
345+
@inline def concat(suffix: String): String = s + suffix
348346

349347
/** Alias for `concat` */
350-
@`inline` def ++[B >: Char](suffix: Iterable[B]): immutable.IndexedSeq[B] = concat(suffix)
348+
@inline def ++[B >: Char](suffix: Iterable[B]): immutable.IndexedSeq[B] = concat(suffix)
351349

352350
/** Alias for `concat` */
353-
@`inline` def ++(suffix: IterableOnce[Char]): String = concat(suffix)
351+
@inline def ++(suffix: IterableOnce[Char]): String = concat(suffix)
354352

355353
/** Alias for `concat` */
356354
def ++(xs: String): String = concat(xs)
@@ -412,14 +410,14 @@ final class StringOps(private val s: String) extends AnyVal {
412410
}
413411

414412
/** Alias for `prepended` */
415-
@`inline` def +: [B >: Char] (elem: B): immutable.IndexedSeq[B] = prepended(elem)
413+
@inline def +: [B >: Char] (elem: B): immutable.IndexedSeq[B] = prepended(elem)
416414

417415
/** A copy of the string with an char prepended */
418416
def prepended(c: Char): String =
419417
new JStringBuilder(s.length + 1).append(c).append(s).toString
420418

421419
/** Alias for `prepended` */
422-
@`inline` def +: (c: Char): String = prepended(c)
420+
@inline def +: (c: Char): String = prepended(c)
423421

424422
/** A copy of the string with all elements from a collection prepended */
425423
def prependedAll[B >: Char](prefix: IterableOnce[B]): immutable.IndexedSeq[B] = {
@@ -432,13 +430,13 @@ final class StringOps(private val s: String) extends AnyVal {
432430
}
433431

434432
/** Alias for `prependedAll` */
435-
@`inline` def ++: [B >: Char] (prefix: IterableOnce[B]): immutable.IndexedSeq[B] = prependedAll(prefix)
433+
@inline def ++: [B >: Char] (prefix: IterableOnce[B]): immutable.IndexedSeq[B] = prependedAll(prefix)
436434

437435
/** A copy of the string with another string prepended */
438436
def prependedAll(prefix: String): String = prefix + s
439437

440438
/** Alias for `prependedAll` */
441-
@`inline` def ++: (prefix: String): String = prependedAll(prefix)
439+
@inline def ++: (prefix: String): String = prependedAll(prefix)
442440

443441
/** A copy of the string with an element appended */
444442
def appended[B >: Char](elem: B): immutable.IndexedSeq[B] = {
@@ -450,28 +448,28 @@ final class StringOps(private val s: String) extends AnyVal {
450448
}
451449

452450
/** Alias for `appended` */
453-
@`inline` def :+ [B >: Char](elem: B): immutable.IndexedSeq[B] = appended(elem)
451+
@inline def :+ [B >: Char](elem: B): immutable.IndexedSeq[B] = appended(elem)
454452

455453
/** A copy of the string with an element appended */
456454
def appended(c: Char): String =
457455
new JStringBuilder(s.length + 1).append(s).append(c).toString
458456

459457
/** Alias for `appended` */
460-
@`inline` def :+ (c: Char): String = appended(c)
458+
@inline def :+ (c: Char): String = appended(c)
461459

462460
/** A copy of the string with all elements from a collection appended */
463-
@`inline` def appendedAll[B >: Char](suffix: IterableOnce[B]): immutable.IndexedSeq[B] =
461+
@inline def appendedAll[B >: Char](suffix: IterableOnce[B]): immutable.IndexedSeq[B] =
464462
concat(suffix)
465463

466464
/** Alias for `appendedAll` */
467-
@`inline` def :++ [B >: Char](suffix: IterableOnce[B]): immutable.IndexedSeq[B] =
465+
@inline def :++ [B >: Char](suffix: IterableOnce[B]): immutable.IndexedSeq[B] =
468466
concat(suffix)
469467

470468
/** A copy of the string with another string appended */
471-
@`inline` def appendedAll(suffix: String): String = s + suffix
469+
@inline def appendedAll(suffix: String): String = s + suffix
472470

473471
/** Alias for `appendedAll` */
474-
@`inline` def :++ (suffix: String): String = s + suffix
472+
@inline def :++ (suffix: String): String = s + suffix
475473

476474
/** Produces a new collection where a slice of characters in this string is replaced by another collection.
477475
*
@@ -488,7 +486,7 @@ final class StringOps(private val s: String) extends AnyVal {
488486
*/
489487
def patch[B >: Char](from: Int, other: IterableOnce[B], replaced: Int): immutable.IndexedSeq[B] = {
490488
val len = s.length
491-
@`inline` def slc(off: Int, length: Int): WrappedString =
489+
@inline def slc(off: Int, length: Int): WrappedString =
492490
new WrappedString(s.substring(off, off+length))
493491
val b = immutable.IndexedSeq.newBuilder[B]
494492
val k = other.knownSize
@@ -645,8 +643,8 @@ final class StringOps(private val s: String) extends AnyVal {
645643

646644
// Note: String.repeat is added in JDK 11.
647645
/** Return the current string concatenated `n` times.
648-
*/
649-
def *(n: Int): String = {
646+
*/
647+
def *(n: Int): String =
650648
if (n <= 0) {
651649
""
652650
} else {
@@ -658,10 +656,9 @@ final class StringOps(private val s: String) extends AnyVal {
658656
}
659657
sb.toString
660658
}
661-
}
662659

663-
@`inline` private[this] def isLineBreak(c: Char) = c == CR || c == LF
664-
@`inline` private[this] def isLineBreak2(c0: Char, c: Char) = c0 == CR && c == LF
660+
@inline private def isLineBreak(c: Char) = c == CR || c == LF
661+
@inline private def isLineBreak2(c0: Char, c: Char) = c0 == CR && c == LF
665662

666663
/** Strip the trailing line separator from this string if there is one.
667664
* The line separator is taken as `"\n"`, `"\r"`, or `"\r\n"`.
@@ -698,7 +695,7 @@ final class StringOps(private val s: String) extends AnyVal {
698695

699696
private[this] val len = s.length
700697
private[this] var index = 0
701-
@`inline` private def done = index >= len
698+
@inline private def done = index >= len
702699
private def advance(): String = {
703700
val start = index
704701
while (!done && !isLineBreak(apply(index))) index += 1
@@ -1118,7 +1115,7 @@ final class StringOps(private val s: String) extends AnyVal {
11181115
* @return The result of applying `op` to `z` and all chars in this string,
11191116
* going left to right. Returns `z` if this string is empty.
11201117
*/
1121-
@`inline` def fold[A1 >: Char](z: A1)(op: (A1, A1) => A1): A1 = foldLeft(z)(op)
1118+
@inline def fold[A1 >: Char](z: A1)(op: (A1, A1) => A1): A1 = foldLeft(z)(op)
11221119

11231120
/** Selects the first char of this string.
11241121
* @return the first char of this string.
@@ -1158,19 +1155,19 @@ final class StringOps(private val s: String) extends AnyVal {
11581155
/** Stepper can be used with Java 8 Streams. This method is equivalent to a call to
11591156
* [[charStepper]]. See also [[codePointStepper]].
11601157
*/
1161-
@`inline` def stepper: IntStepper with EfficientSplit = charStepper
1158+
@inline def stepper: IntStepper with EfficientSplit = charStepper
11621159

11631160
/** Steps over characters in this string. Values are packed in `Int` for efficiency
11641161
* and compatibility with Java 8 Streams which have an efficient specialization for `Int`.
11651162
*/
1166-
@`inline` def charStepper: IntStepper with EfficientSplit = new CharStringStepper(s, 0, s.length)
1163+
@inline def charStepper: IntStepper with EfficientSplit = new CharStringStepper(s, 0, s.length)
11671164

11681165
/** Steps over code points in this string.
11691166
*/
1170-
@`inline` def codePointStepper: IntStepper with EfficientSplit = new CodePointStringStepper(s, 0, s.length)
1167+
@inline def codePointStepper: IntStepper with EfficientSplit = new CodePointStringStepper(s, 0, s.length)
11711168

11721169
/** Tests whether the string is not empty. */
1173-
@`inline` def nonEmpty: Boolean = !s.isEmpty
1170+
@inline def nonEmpty: Boolean = !s.isEmpty
11741171

11751172
/** Returns new sequence with elements in reversed order.
11761173
* @note $unicodeunaware
@@ -1268,7 +1265,7 @@ final class StringOps(private val s: String) extends AnyVal {
12681265
}
12691266

12701267
/** Selects all chars of this string which do not satisfy a predicate. */
1271-
@`inline` def filterNot(pred: Char => Boolean): String = filter(c => !pred(c))
1268+
@inline def filterNot(pred: Char => Boolean): String = filter(c => !pred(c))
12721269

12731270
/** Copy chars of this string to an array.
12741271
* Fills the given array `xs` starting at index 0.
@@ -1277,7 +1274,7 @@ final class StringOps(private val s: String) extends AnyVal {
12771274
*
12781275
* @param xs the array to fill.
12791276
*/
1280-
@`inline` def copyToArray(xs: Array[Char]): Int =
1277+
@inline def copyToArray(xs: Array[Char]): Int =
12811278
copyToArray(xs, 0, Int.MaxValue)
12821279

12831280
/** Copy chars of this string to an array.
@@ -1288,7 +1285,7 @@ final class StringOps(private val s: String) extends AnyVal {
12881285
* @param xs the array to fill.
12891286
* @param start the starting index.
12901287
*/
1291-
@`inline` def copyToArray(xs: Array[Char], start: Int): Int =
1288+
@inline def copyToArray(xs: Array[Char], start: Int): Int =
12921289
copyToArray(xs, start, Int.MaxValue)
12931290

12941291
/** Copy chars of this string to an array.

0 commit comments

Comments
 (0)