book icon indicating copy to clipboard operation
book copied to clipboard

Incorrect field name in chapter 13

Open infinityfye opened this issue 3 years ago • 0 comments
trafficstars

  • [x] I have checked the latest main branch to see if this has already been fixed
  • [x] I have searched existing issues and pull requests for duplicates

URL to the section(s) of the book with this problem:

  • https://doc.rust-lang.org/nightly/book/ch13-03-improving-our-io-project.html
  • https://doc.rust-lang.org/book/ch13-03-improving-our-io-project.html
  • https://github.com/rust-lang/book/blob/main/src/ch13-03-improving-our-io-project.md

Description of the problem: This concerns the IO project from chapter 12 and the improvements applied in chapter 13. The typo specifically is filename as opposed to file_path when referring to the Config struct field and when referring to the variable in Config::build In line 31 it is stated that the Config struct field is filename while it is file_path. While in line 121 it is stated that the value is filename while it should be file_path

Suggested fix: Change both occurrences of filename to file_path. I would have opened a PR directly, but there is another solution that wouldn't cause a difference with the printed version; to change the linked code in the Config struct definition and in Config::build. This will break compatibility with chapter12, but it's still a viable solution, I think.

infinityfye avatar Oct 25 '22 13:10 infinityfye