rust-lang / rust-clippy

A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
https://rust-lang.github.io/rust-clippy/
Other
11.43k stars 1.54k forks source link

Unclear message in `type_complexity` #13387

Closed ChrisJefferson closed 1 month ago

ChrisJefferson commented 1 month ago

Summary

I'm not clear what type_complexity wants me to do.

The output says " very complex type used. Consider factoring parts into type definitions"

The webpage ( https://rust-lang.github.io/rust-clippy/master/index.html#/type_complexity ) tells me the same thing (use a type definition to simply).

The example shows me some bad code, but there is no example of what it should look like 'fixed'.

Attempts to google for 'type definition rust' just get me to pages that define what a type is in rust, and list the various data types available in Rust.

I suspect this is an easy doc fix for someone who knows what a 'type definition' is, and could maybe give an example on the webpage (might be too long for the terminal?) -- or is there a more searchable term than type definition?

alex-semenyuk commented 1 month ago

@rustbot label A-documentation

alex-semenyuk commented 1 month ago

@rustbot claim

alex-semenyuk commented 1 month ago

@ChrisJefferson merged clarified example. Could you please check - is it clear now? if so you could close it

ChrisJefferson commented 1 month ago

Thanks, much clearer :)