From c04088fed1b8faea6b2928bb5e09ab367076950c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 7 Aug 2020 13:37:22 +0200 Subject: Cleanup: Clang-Tidy else-after-return fixes This addresses warnings from Clang-Tidy's `readability-else-after-return` rule. This should be the final commit of the series of commits that addresses this particular rule. No functional changes. --- source/blender/simulation/intern/hair_volume.cpp | 16 +++++++--------- source/blender/simulation/intern/implicit_blender.c | 20 ++++++++------------ .../blender/simulation/intern/particle_function.cc | 5 ++--- 3 files changed, 17 insertions(+), 24 deletions(-) (limited to 'source/blender/simulation') diff --git a/source/blender/simulation/intern/hair_volume.cpp b/source/blender/simulation/intern/hair_volume.cpp index c80ae69ce73..c24b7154d13 100644 --- a/source/blender/simulation/intern/hair_volume.cpp +++ b/source/blender/simulation/intern/hair_volume.cpp @@ -710,9 +710,8 @@ BLI_INLINE float hair_volume_density_divergence(float density, if (density > density_threshold && density > target_density) { return strength * logf(target_density / density); } - else { - return 0.0f; - } + + return 0.0f; } bool SIM_hair_volume_solve_divergence(HairGrid *grid, @@ -1030,14 +1029,13 @@ bool SIM_hair_volume_solve_divergence(HairGrid *grid, return true; } - else { - /* Clear result in case of error */ - for (i = 0, vert = grid->verts; i < num_cells; i++, vert++) { - zero_v3(vert->velocity_smooth); - } - return false; + /* Clear result in case of error */ + for (i = 0, vert = grid->verts; i < num_cells; i++, vert++) { + zero_v3(vert->velocity_smooth); } + + return false; } #if 0 /* XXX weighting is incorrect, disabled for now */ diff --git a/source/blender/simulation/intern/implicit_blender.c b/source/blender/simulation/intern/implicit_blender.c index 856572aa3f5..1f6e67cb9ac 100644 --- a/source/blender/simulation/intern/implicit_blender.c +++ b/source/blender/simulation/intern/implicit_blender.c @@ -1711,9 +1711,8 @@ BLI_INLINE float fbstar(float length, float L, float kb, float cb) if (tempfb_fl < fbstar_fl) { return fbstar_fl; } - else { - return tempfb_fl; - } + + return tempfb_fl; } // function to calculae bending spring force (taken from Choi & Co) @@ -1725,9 +1724,8 @@ BLI_INLINE float fbstar_jacobi(float length, float L, float kb, float cb) if (tempfb_fl < fbstar_fl) { return -cb; } - else { - return -kb * fbderiv(length, L); - } + + return -kb * fbderiv(length, L); } /* calculate elonglation */ @@ -1864,9 +1862,8 @@ bool SIM_mass_spring_force_spring_bending( return true; } - else { - return false; - } + + return false; } BLI_INLINE void poly_avg(lfVector *data, const int *inds, int len, float r_avg[3]) @@ -2352,9 +2349,8 @@ bool SIM_mass_spring_force_spring_goal(Implicit_Data *data, return true; } - else { - return false; - } + + return false; } #endif /* IMPLICIT_SOLVER_BLENDER */ diff --git a/source/blender/simulation/intern/particle_function.cc b/source/blender/simulation/intern/particle_function.cc index 035e6d50e21..69977eb2054 100644 --- a/source/blender/simulation/intern/particle_function.cc +++ b/source/blender/simulation/intern/particle_function.cc @@ -102,9 +102,8 @@ fn::GVSpan ParticleFunctionEvaluator::get(int output_index, StringRef expected_n if (particle_fn_.output_is_global_[output_index]) { return fn::GVSpan::FromSingleWithMaxSize(type, buffer); } - else { - return fn::GVSpan(fn::GSpan(type, buffer, mask_.min_array_size())); - } + + return fn::GVSpan(fn::GSpan(type, buffer, mask_.min_array_size())); } void ParticleFunctionEvaluator::compute_globals() -- cgit v1.2.3