summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEksperimental <eksperimental@users.noreply.github.com>2017-05-22 03:48:01 -0500
committerJosé Valim <jose.valim@gmail.com>2017-05-22 10:48:01 +0200
commitc8d6fb00544cdfd049059c558766d51e3c410c9a (patch)
treeb4d50b866590f60df3927611070fdc25bb71d57d
parentdb60c0d0f21d0b9d7b03685c944c85f11f7fba54 (diff)
downloadelixir-c8d6fb00544cdfd049059c558766d51e3c410c9a.tar.gz
Deprecation of "strip" functions in String module (#6128)
-rw-r--r--CHANGELOG.md4
-rw-r--r--lib/elixir/pages/Deprecations.md7
-rw-r--r--lib/elixir/src/elixir_dispatch.erl6
3 files changed, 11 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f38f62424..0a8dc706d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -68,6 +68,10 @@
* [Kernel] `:as_char_lists value` in `Inspect.Opts.t/0` type, in favor of `:as_charlists`
* [Kernel] `:char_lists` key in `Inspect.Opts.t/0` type, in favor of `:charlists`
* [Module] Using Erlang parse transforms via `@compile {:parse_transform, _}` is deprecated
+ * [String] `String.ljust/3` and `String.rjust/3` are deprecated in favor of `String.pad_leading/3` and `String.pad_trailing/3` with a binary padding
+ * [String] `String.strip/1` and `String.strip/2` are deprecated in favor of `String.trim/1` and `String.trim/2`
+ * [String] `String.lstrip/1` and `String.rstrip/1` are deprecated in favor of `String.trim_leading/1` and `String.trim_trailing/1`
+ * [String] `String.lstrip/2` and `String.rstrip/2` are deprecated in favor of `String.trim_leading/2` and `String.trim_trailing/2` with a binary as second argument
 * [Typespec] `char_list/0` type is deprecated in favor of `charlist/0`
## v1.4
diff --git a/lib/elixir/pages/Deprecations.md b/lib/elixir/pages/Deprecations.md
index 44e1b637c..1edebc371 100644
--- a/lib/elixir/pages/Deprecations.md
+++ b/lib/elixir/pages/Deprecations.md
@@ -24,6 +24,10 @@ Passing a non-Time to `Time.to_iso8601/1` | [v1.5] | Explicitly co
`GenEvent` module | [v1.5] | `Supervisor` and `GenServer` (v1.0);<br/>[`GenStage`](https://hex.pm/packages/gen_stage) (v1.3);<br/>[`:gen_event`](http://www.erlang.org/doc/man/gen_event.html) (OTP 17)
`Integer.to_char_list/1` | [v1.5] | `Integer.to_charlist/1` (v1.3)
`Kernel.to_char_list/1` | [v1.5] | `Kernel.to_charlist/1` (v1.3)
+`String.ljust/3` and `String.rjust/3` | [v1.5] | `String.pad_leading/3` and `String.pad_trailing/3` with a binary padding (v1.3)
+`String.strip/1` and `String.strip/2` | [v1.5] | `String.trim/1` and `String.trim/2` (v1.3)
+`String.lstrip/1` and `String.rstrip/1` | [v1.5] | `String.trim_leading/1` and `String.trim_trailing/1` (v1.3)
+`String.lstrip/2` and `String.rstrip/2` | [v1.5] | `String.trim_leading/2` and `String.trim_trailing/2` with a binary as second argument (v1.3)
`String.to_char_list/1` | [v1.5] | `String.to_charlist/1` (v1.3)
`()` to mean `nil` | [v1.5] | `nil` (v1.0)
`:as_char_lists` value in `t:Inspect.Opts.t/0` type | [v1.5] | `:as_charlists` (v1.3)
@@ -44,9 +48,6 @@ Passing a non-Time to `Time.to_iso8601/1` | [v1.5] | Explicitly co
`Mix.Utils.underscore/1` | [v1.4] | `Macro.underscore/1` (v1.2)
Variable used as function call | [v1.4] | Use parentheses (v1.0)
Anonymous functions with no expression after `->` | [v1.4] | Use an expression or explicitly return `nil` (v1.0)
-`String.strip/1` | [v1.4] | `String.trim/1` (v1.2)
-`String.lstrip/2` and `String.rstrip/2` | [v1.4] | `String.trim_leading/2` and `String.trim_trailing/2` (v1.2)
-`String.ljust/2` and `String.rjust/2` | [v1.4] | `String.pad_leading/2` and `String.pad_trailing/2` (v1.2)
`Dict` module | [v1.3] | `Keyword` (v1.0);<br/>`Map` (v1.2)
`Keyword.size/1` | [v1.3] | `Kernel.length/1` (v1.0)
`Map.size/1` | [v1.3] | `Kernel.map_size/1` (v1.0)
diff --git a/lib/elixir/src/elixir_dispatch.erl b/lib/elixir/src/elixir_dispatch.erl
index 8d258bec8..0b853e41e 100644
--- a/lib/elixir/src/elixir_dispatch.erl
+++ b/lib/elixir/src/elixir_dispatch.erl
@@ -370,11 +370,11 @@ deprecation('Elixir.String', lstrip, 1) ->
deprecation('Elixir.String', rstrip, 1) ->
"use String.trim_trailing/1";
deprecation('Elixir.String', strip, 2) ->
- "use String.trim/2 with a binary second argument";
+ "use String.trim/2 with a binary as second argument";
deprecation('Elixir.String', lstrip, 2) ->
- "use String.trim_leading/2 with a binary second argument";
+ "use String.trim_leading/2 with a binary as second argument";
deprecation('Elixir.String', rstrip, 2) ->
- "use String.trim_trailing/2 with a binary second argument";
+ "use String.trim_trailing/2 with a binary as second argument";
deprecation('Elixir.String', rjust, 2) ->
"use String.pad_leading/2";
deprecation('Elixir.String', rjust, 3) ->