Skip to content

Commit 00cc39e

Browse files
fredrikekreararslan
authored andcommitted
fix some deprecations (#106)
* update ind(min|max) to arg(min|max) * update uninitialized to undef * fix using A.B deprecation warning for non-modules * use Compat instead of VERSION-dancing * contains(haystack, needle) -> occursin(needle, haystack) * STDERR -> stderr
1 parent ca42421 commit 00cc39e

File tree

7 files changed

+13
-19
lines changed

7 files changed

+13
-19
lines changed

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
julia 0.6
2-
Compat 0.51.0
2+
Compat 0.62.0
33
JSON

src/BenchmarkTools.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ using Compat
66
using JSON
77
using Base.Iterators
88

9-
if VERSION >= v"0.7.0-DEV.3052"
10-
using Printf
11-
end
9+
using Compat.Printf
10+
1211

1312
const BENCHMARKTOOLS_VERSION = v"0.2.2"
1413

src/execution.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ end
132132
# the logistic function is useful for determining `evals` for `1 < t < RESOLUTION`
133133
logistic(u, l, k, t, t0) = round(Int, ((u - l) / (1 + exp(-k * (t - t0)))) + l)
134134

135-
const EVALS = Vector{Int}(uninitialized, 9000) # any `t > length(EVALS)` should get an `evals` of 1
135+
const EVALS = Vector{Int}(undef, 9000) # any `t > length(EVALS)` should get an `evals` of 1
136136
for t in 1:400 (EVALS[t] = logistic(1006, 195, -0.025, t, 200)) end # EVALS[1] == 1000, EVALS[400] == 200
137137
for t in 401:1000 (EVALS[t] = logistic(204, -16, -0.01, t, 800)) end # EVALS[401] == 200, EVALS[1000] == 10
138138
for i in 1:8 (EVALS[((i*1000)+1):((i+1)*1000)] = 11 - i) end # linearly decrease from EVALS[1000]

src/serialization.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
if VERSION >= v"0.7.0-DEV.2437"
2-
using Base.Meta.parse
3-
end
1+
using Base.Meta: parse
42

53
const VERSIONS = Dict("Julia" => string(VERSION),
64
"BenchmarkTools" => string(BENCHMARKTOOLS_VERSION))
@@ -28,7 +26,7 @@ function recover(x::Vector)
2826
fields = x[2]::Dict
2927
T = eval(parse(typename))::Type
3028
fc = fieldcount(T)
31-
xs = Vector{Any}(uninitialized, fc)
29+
xs = Vector{Any}(undef, fc)
3230
for i = 1:fc
3331
ft = fieldtype(T, i)
3432
fn = String(fieldname(T, i))

src/trials.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ end
109109
Base.copy(t::TrialEstimate) = TrialEstimate(copy(t.params), t.time, t.gctime, t.memory, t.allocs)
110110

111111
function Base.minimum(trial::Trial)
112-
i = indmin(trial.times)
112+
i = argmin(trial.times)
113113
return TrialEstimate(trial, trial.times[i], trial.gctimes[i])
114114
end
115115

116116
function Base.maximum(trial::Trial)
117-
i = indmax(trial.times)
117+
i = argmax(trial.times)
118118
return TrialEstimate(trial, trial.times[i], trial.gctimes[i])
119119
end
120120

test/ExecutionTests.jl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ module ExecutionTests
33
using BenchmarkTools
44
using Compat
55
using Compat.Test
6-
if VERSION >= v"0.7.0-DEV.3019"
7-
using IterativeEigensolvers
8-
elseif VERSION >= v"0.7.0-DEV.2655"
9-
using IterativeEigenSolvers
10-
end
6+
7+
using Compat.IterativeEigensolvers
118

129
seteq(a, b) = length(a) == length(b) == length(intersect(a, b))
1310

@@ -174,9 +171,9 @@ let fname = tempname()
174171
end
175172
s = read(fname, String)
176173
try
177-
@test contains(s, r"[0-9.]+ \w*s \([0-9]* allocations?: [0-9]+ bytes\)")
174+
@test occursin(r"[0-9.]+ \w*s \([0-9]* allocations?: [0-9]+ bytes\)", s)
178175
catch
179-
println(STDERR, "@btime output didn't match ", repr(s))
176+
println(stderr, "@btime output didn't match ", repr(s))
180177
rethrow()
181178
end
182179
finally

test/SerializationTests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ end
8989
error("madness")
9090
catch err
9191
# This function thows a bunch of errors, so test for this specifically
92-
@test contains(err.msg, "Unexpected JSON format")
92+
@test occursin("Unexpected JSON format", err.msg)
9393
end
9494
end
9595

0 commit comments

Comments
 (0)