Skip to content

string slices phrasing, ch04-03 #4816

Description

@phgz
  • I have searched open and closed issues and pull requests for duplicates, using these search terms:

    • slice
  • I have checked the latest main branch to see if this has already been fixed, in this file:

    • n/a

URL to the section(s) of the book with this problem: https://doc.rust-lang.org/book/ch04-03-slices.html#string-slices-as-parameters

Description of the problem: Below listing 4.9, it says: "If we have a String, we can pass a slice of the String or a reference to the String.", then on the next paragraph: "Defining a function to take a string slice instead of a reference to a String makes [...]".

Suggested fix: The "instead of" is confusing, because it CAN accept a reference to a string. Maybe cut that last part, or specify: "Defining a function to take a string slice can accept both string slices and string references". Or otherwise: "Defining a function with a string slice parameter instead of [...]".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions