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

Mark str::trim.* functions as #[must_use]. #57106

Merged
merged 3 commits into from
Jan 31, 2019

Commits on Dec 26, 2018

  1. mark str::string::String.trim.* functions as #[must_use].

    The functions return a reference to a new object and do not modify in-place
    as the following code shows:
    ````
    let s = String::from("   hello   ");
    s.trim();
    assert_eq!(s, "   hello   ");
    ````
    
    The new reference should be bound to a variable as now indicated by #[must_use].
    matthiaskrgr committed Dec 26, 2018
    Configuration menu
    Copy the full SHA
    809a1a8 View commit details
    Browse the repository at this point in the history
  2. Update src/libcore/str/mod.rs, tweak must_use message

    trimmed string is returned as a slice instead of a new allocation
    
    Co-Authored-By: matthiaskrgr <matthias.krueger@famsik.de>
    zackmdavis and matthiaskrgr committed Dec 26, 2018
    Configuration menu
    Copy the full SHA
    e7ce868 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    74e9057 View commit details
    Browse the repository at this point in the history