[SERVER-66956] Coverity analysis defect 122327: Redundant test Created: 02/Jun/22 Updated: 29/Oct/23 Resolved: 23/Jun/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 6.1.0-rc0, 5.0.16 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Coverity Collector User | Assignee: | Daniel Segel |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | coverity, neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Backport Requested: |
v6.0, v5.0
|
||||||||||||
| Sprint: | QO 2022-06-13, QO 2022-06-27 | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
Redundant test By the time the program execution reaches the test of this condition there is only one possible outcome for the test. The code at the destination of this branch is not dead, either because this condition is always true or because there is at least one other branch that reaches it. Test always evaluates the same |
| Comments |
| Comment by Githook User [ 21/Feb/23 ] |
|
Author: {'name': 'Daniel Segel', 'email': 'daniel_segel@brown.edu', 'username': 'dhsegel'}Message: |
| Comment by Sam Mercier [ 23/Jun/22 ] |
|
Sure! |
| Comment by Githook User [ 23/Jun/22 ] |
|
Author: {'name': 'Daniel Segel', 'email': 'daniel_segel@brown.edu', 'username': 'dhsegel'}Message: |
| Comment by Kyle Suarez [ 23/Jun/22 ] |
|
daniel.segel@mongodb.com and samuel.mercier@mongodb.com, since |
| Comment by Kyle Suarez [ 02/Jun/22 ] |
|
There's no need for the wrapping if-statement on line 1186 because the static_cast of a non-null pointer won't ever be nullptr. Ditto the if and static_cast on line 1197. |