Skip to content

Commit

Permalink
Use === for checks against nothing
Browse files Browse the repository at this point in the history
The compiler likes this a lot more
  • Loading branch information
ararslan committed Dec 20, 2018
1 parent 66a40ac commit 3114d51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/atoms/affine/index.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function curvature(x::IndexAtom)
end

function evaluate(x::IndexAtom)
if x.inds == nothing
if x.inds === nothing
return getindex(evaluate(x.children[1]), x.rows, x.cols)
else
return getindex(evaluate(x.children[1]), x.inds)
Expand All @@ -52,7 +52,7 @@ function conic_form!(x::IndexAtom, unique_conic_forms::UniqueConicForms=UniqueCo
m = length(x)
n = length(x.children[1])

if x.inds == nothing
if x.inds === nothing
sz = length(x.cols) * length(x.rows)
J = Array{Int}(undef, sz)
k = 1
Expand Down
4 changes: 2 additions & 2 deletions src/variable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function vexity(x::Variable)
end

function evaluate(x::Variable)
return x.value == nothing ? error("Value of the variable is yet to be calculated") : x.value
return x.value === nothing ? error("Value of the variable is yet to be calculated") : x.value
end

function sign(x::Variable)
Expand Down Expand Up @@ -114,7 +114,7 @@ end

# fix variables to hold them at their current value, and free them afterwards
function fix!(x::Variable)
x.value == nothing && error("This variable has no value yet; cannot fix value to nothing!")
x.value === nothing && error("This variable has no value yet; cannot fix value to nothing!")
push!(x.sets, :fixed)
x.vexity = ConstVexity()
x
Expand Down

0 comments on commit 3114d51

Please sign in to comment.