setindex! of triangular matrices could be less restrictive when setting to a structural zero: https://github.com/JuliaLang/julia/blob/4ed484fe7ac591da67bfe384c369430ed658606d/stdlib/LinearAlgebra/src/triangular.jl#L231
it could be iszero(x) instead.
I'm not sure about diagonals of unit triangular matrices (Julia doesn't have isoneunit) but isone(x) may be better then x == 1 as well.