Skip to content

Commit

Permalink
fix chars/grapheme_clusters warning
Browse files Browse the repository at this point in the history
  • Loading branch information
lopex committed Apr 9, 2018
1 parent 005fc40 commit 408fc81
Showing 1 changed file with 8 additions and 32 deletions.
40 changes: 8 additions & 32 deletions core/src/main/java/org/jruby/RubyString.java
Expand Up @@ -5438,14 +5438,8 @@ private IRubyObject enumerateChars(ThreadContext context, String name, Block blo

if (block.isGiven()) {
if (wantarray) {
// this code should be live in 3.0
if (false) { // #if STRING_ENUMERATORS_WANTARRAY
runtime.getWarnings().warn("given block not used");
ary = RubyArray.newArray(runtime, str.strLength());
} else {
runtime.getWarnings().warning("passing a block to String#chars is deprecated");
wantarray = false;
}
runtime.getWarnings().warning("passing a block to String#" + name + " is deprecated");
wantarray = false;
}
}
else {
Expand Down Expand Up @@ -5507,14 +5501,8 @@ private IRubyObject enumerateCodepoints(ThreadContext context, String name, Bloc

if (block.isGiven()) {
if (wantarray) {
// this code should be live in 3.0
if (false) { // #if STRING_ENUMERATORS_WANTARRAY
runtime.getWarnings().warn("given block not used");
ary = RubyArray.newArray(runtime, str.length().getLongValue());
} else {
runtime.getWarnings().warning("passing a block to String#codepoints is deprecated");
wantarray = false;
}
runtime.getWarnings().warning("passing a block to String#" + name + " is deprecated");
wantarray = false;
}
}
else {
Expand Down Expand Up @@ -5547,14 +5535,8 @@ private IRubyObject enumerateBytes(ThreadContext context, String name, Block blo

if (block.isGiven()) {
if (wantarray) {
// this code should be live in 3.0
if (false) { // #if STRING_ENUMERATORS_WANTARRAY
runtime.getWarnings().warn("given block not used");
ary = RubyArray.newArray(runtime);
} else {
runtime.getWarnings().warning("passing a block to String#bytes is deprecated");
wantarray = false;
}
runtime.getWarnings().warning("passing a block to String#" + name + " is deprecated");
wantarray = false;
}
}
else {
Expand Down Expand Up @@ -5625,14 +5607,8 @@ private IRubyObject enumerateGraphemeClusters(ThreadContext context, String name

if (block.isGiven()) {
if (wantarray) {
// this code should be live in 3.0
if (false) {
runtime.getWarnings().warn("given block not used");
ary = RubyArray.newArray(runtime);
} else {
runtime.getWarnings().warning("passing a block to String#grapheme_clusters is deprecated");
wantarray = false;
}
runtime.getWarnings().warning("passing a block to String#" + name + " is deprecated");
wantarray = false;
}
} else {
if (wantarray)
Expand Down

0 comments on commit 408fc81

Please sign in to comment.