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

[wip] library: mark more functions that return String as #[must_use] #50462

Closed
wants to merge 1 commit into from

Commits on May 10, 2018

  1. 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()
    matthiaskrgr committed May 10, 2018
    Configuration menu
    Copy the full SHA
    aa127d8 View commit details
    Browse the repository at this point in the history