Text this: Rigidity of some classes of Lie algebras in connection to Leibniz algebras