Skip to content
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

Should the usage of {Option, Result}::expect be avoided to safe memory? #42

Closed
XOSplicer opened this issue May 16, 2018 · 1 comment
Closed

Comments

@XOSplicer
Copy link
Contributor

Currently there are a few functions that use {Option, Result}::expect because there is no way to return Option or Result. Examples are LinearMap::{index, index_mut} , Vec::from_iter and IndexMap::index.

AFIK the messages that are associated with them are statically allocated in the data section of the binary and therefore take up space, even if no panic actualy can occure.

As this library is used with microcontrollers, should those strings be removed?
I don't know if rust is smart enough to remove them from the binary by itself.

However some clarity in panic messages would be sacrificed in exchange for it.

@sanmai-NL
Copy link

These strings can be elided with the proper panic implementation. See rust-lang/rust#44489. You can close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants