fn gives_ownership() -> String {             // gives_ownership will move its
                                             // return value into the function
                                             // that calls it

    let some_string = String::from("hello"); // some_string comes into scope

    some_string                              // some_string is returned and
                                             // moves out to the calling
                                             // function
}
// Here, s3 goes out of scope and is dropped. s2 goes out of scope but was
// moved, so nothing happens. s1 goes out of scope and is dropped.
Here, s3 goes out of scope and is dropped. s2 goes out of scope but was
moved, so nothing happens. s1 goes out of scope and is dropped.
Here s3 goes out of scope and is dropped . s2 goes out of scope but was moved so nothing happens . s1 goes out of scope and is dropped .
fn gives_ownership() -> String {             // gives_ownership will move its
                                             // return value into the function
                                             // that calls it
    let some_string = String::from("hello"); // some_string comes into scope
    some_string                              // some_string is returned and
                                             // moves out to the calling
                                             // function
}
fn gives_ownership ( ) -> String { // gives_ownership will move its // return value into the function // that calls it let some_string = String :: from ( " " ) ; // some_string comes into scope some_string // some_string is returned and // moves out to the calling // function }
Here, s3 goes out of scope and is dropped.
Here s3 goes out of scope and is dropped .