I am writing a server and I am thinking about using some of the more restrictive clippy lints to catch possibly panicking code or lossy integer conversions.
My reasons are: On the one hand I am pretty excessive with unwrap() during debugging and initial writing and want to catch any remainder of it in the CI. On the other hand there is a lot of buffer handling in the code and I want to ensure that any programming error there does not lead to unwinding and the difficulties with panic safety.
At one point in the code base tokio is used and the tokio::select macro pulls in a panic. This obviously is complained about by clippy.
My questions are:
What do you think about the aim of enabling the really restrictive clippy lints, that catch most possibilities for a panic. Does it make sense? Should I worry less about panicking in a server and just catch the unwinding?
What should I do about tokio::select? Also I cannot just mute the warning by placing #[allow(clippy::panic)] on top of the select macro.
Oh well, now I am starting to get how it works. I provided an else branch and the warning vanished.
But I am struggling how the docs apply to my case. The docs say:
select! panics if all branches are disabled and there is no provided else branch. A branch is disabled when the provided if precondition returns falseor when the pattern does not match the result of <async expression>.