In Ch20, BufReader
is initialized using mutable borrow of TcpStream
unnecessarily
#3957
Labels
BufReader
is initialized using mutable borrow of TcpStream
unnecessarily
#3957
I have searched open and closed issues and pull requests for duplicates, using these search terms:
BufReader
I have checked the latest
main
branch to see if this has already been fixed, in this file:URL to the section(s) of the book with this problem:
https://doc.rust-lang.org/book/ch20-01-single-threaded.html
https://doc.rust-lang.org/book/ch20-02-multithreaded.html
Description of the problem:
In all the code listings in Chapter 20, a
BufReader
is used to read the HTTP request. The BufReader is initialized using a mutable borrow of TcpStream:However, it seems the mutable borrow isn't necessary here. The code works just fine when
mut
is removed. What's the consideration here?Suggested fix:
Change the initialization to use immutable borrow.
The text was updated successfully, but these errors were encountered: