Fix deprecation: std.utf.toUTF8 -> encode#5143
Merged
JackStouffer merged 1 commit intodlang:masterfrom Feb 17, 2017
Merged
Conversation
std/json.d
Outdated
| } | ||
| char[4] buf; | ||
| str.put(toUTF8(buf, val)); | ||
| encode(buf, val); |
Contributor
There was a problem hiding this comment.
immutable len = encode(buf, val);
str.put(buf[0 .. len]);
std/uri.d
Outdated
| import std.utf : toUTF8; | ||
| // selective imports trigger wrong deprecation | ||
| // https://issues.dlang.org/show_bug.cgi?id=17193 | ||
| import std.utf; |
Contributor
There was a problem hiding this comment.
this is going to trigger a failure in circle
std/json.d
Outdated
| { | ||
| import std.ascii : isWhite, isDigit, isHexDigit, toUpper, toLower; | ||
| import std.utf : toUTF8; | ||
| import std.utf : encode, Yes; |
Contributor
There was a problem hiding this comment.
Yes is from std.typecons
Contributor
Author
There was a problem hiding this comment.
FWIW any module using template flags is supposed to export Yes as well, so this is really personal preference or personal purism ;-)
std/stdio.d
Outdated
| auto b = toUTF8(buf, c); | ||
| foreach (i ; 0 .. b.length) | ||
| trustedFPUTC(b[i], handle_); | ||
| auto len = encode(buf, c); |
a4831ed to
31c4226
Compare
JackStouffer
approved these changes
Feb 17, 2017
Contributor
|
Auto-merge toggled on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It seems like DMD doesn't like deprecating only one symbol. For selective imports it will always trigger a deprecation warning even if the symbol isn't used (issue 17193).
This PR fixes the deprecation warnings from
toUTF8on Posix.grepshows that there are more on Windows.