-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warn for Vec<Box<T>> where T: Sized #3530
Comments
For example, it might make sense when |
Adds lint for Vec<Box<T: Sized>> This adds, and subsequently closes #3530. This is the first time I've ever worked with anything remotely close to internal Rust code, so I'm very much unsure about the if_chain! to figure this out! I can't get rustfmt working on WSL with nightly 2018-12-07: `error: component 'rustfmt' for target 'x86_64-unknown-linux-gnu' is unavailable for download`
Adds lint for Vec<Box<T: Sized>> This adds, and subsequently closes #3530. This is the first time I've ever worked with anything remotely close to internal Rust code, so I'm very much unsure about the if_chain! to figure this out! I can't get rustfmt working on WSL with nightly 2018-12-07: `error: component 'rustfmt' for target 'x86_64-unknown-linux-gnu' is unavailable for download`
Changes: ```` rustup rust-lang/rust#52994 Fix test Line length fix Remove references to sized for end users Remove DUMMY_SP Add suggestion for replacement Update lint definitions Lint for Vec<Box<T: Sized>> - Closes rust-lang#3530 Fix doc_markdown mixed case false positive question_mark: Suggest Some(opt?) for if-else redundant_field_names: Do not trigger on path with type params question_mark: Lint only early returns question_mark: Fix applicability Remove obsolete comment new_without_default, partialeq_ne_impl: Use span_lint_node Update .stderr after rebase cargo fmt and remove stabilized feature Make suggestion Applicability::MachineApplicable Address review feedback Extract method Check array lengths to prevent OOB access Add suggestion for explicit_write lint Fix write_with_newline escaping false positive ````
Another example: reallocation of the vector when growing it is slower and copies more bytes when the size of |
Could this warning be deactivate when the struct is large ? |
@wiiznokes The lint already checks that the type's size is lower than a threshold to avoid linting on large types. You can override |
Remove Known problems section for `vec_box` since [issue](#3530 (comment)) > Vec<Box<T: Sized>> makes sense if T is a large type can be handled > The lint already checks that the type's size is lower than a threshold to avoid linting on large types. changelog: none
A fellow Rust programmer pointed me to this mistake in my code:
I'm quite new to Rust, but is there ever a point where Vec<Box<T: Sized>> is correct?
The text was updated successfully, but these errors were encountered: