-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
library: mark more functions that return String as #[must_use]
If the return value (String) of the function is not used, the function call is technically in vain (unless there are side effects) and the entire function call could be ommitted. Warn about unused return values of -> String functions. Example code: let mut x = Sting::from("hello"); x.push_str(" world!"); x.to_uppercase(); println!("{}", x); will print "hello world!" instead of "HELLO WORLD!") because the result of .to_uppercase() is not caught in a variable. std::str::to_lowercase() std::str::to_uppercase() std::str::escape_debug() std::str::escape_default() std::str::escape_unicode() std::str::into_string() std::str::repeat() std::str::to_ascii_uppercase() std::str::to_ascii_lowercase() std::String::with_capacity() std::String::from_str() std::String::from_utf16_lossy() std::String::from_raw_parts() std::String::from_utf8_unchecked() std::String::split_off()
- Loading branch information
1 parent
95d0b9e
commit aa127d8
Showing
3 changed files
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters