Skip to content

Commit

Permalink
use eachindex instead of 1:length
Browse files Browse the repository at this point in the history
Co-authored-by: Frames White <oxinabox@ucc.asn.au>
  • Loading branch information
ElOceanografo and oxinabox authored Oct 12, 2023
1 parent 3b29953 commit ef72d49
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rulesets/SparseArrays/sparsematrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,6 @@ end

Check warning on line 164 in src/rulesets/SparseArrays/sparsematrix.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: src/rulesets/SparseArrays/sparsematrix.jl:164:-
function _diagm_back(p, ȳ)
k, v = p
d = diag(unthunk(ȳ), k)[1:length(v)] # handle if diagonal was smaller than matrix
d = diag(unthunk(ȳ), k)[eachindex(v)] # handle if diagonal was smaller than matrix
return Tangent{typeof(p)}(second = d)

Check warning on line 168 in src/rulesets/SparseArrays/sparsematrix.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: src/rulesets/SparseArrays/sparsematrix.jl:168:- return Tangent{typeof(p)}(second = d) src/rulesets/SparseArrays/sparsematrix.jl:169:-end src/rulesets/SparseArrays/sparsematrix.jl:178:+ return Tangent{typeof(p)}(; second=d) src/rulesets/SparseArrays/sparsematrix.jl:179:+end
end

0 comments on commit ef72d49

Please sign in to comment.