Skip to content
Snippets Groups Projects
  • Michael McDonnell's avatar
    5a6dcad4
    Fix description deprecation warnings · 5a6dcad4
    Michael McDonnell authored
    The `description` and `cause` methods in `Error` were soft deprecated in Rust 1.27 and hard deprecated in Rust 1.42 [[1]]. This change removes the use of these deprecated methods and fixes three deprecation warnings.
    
    You can verify that the test output has not changed with the following steps:
    
    1. Create the file `/etc/pkg.d/localtest`
    2. Add the line `localhost:1234` to `/etc/pkg.d/localtest`
    3. Run Netcat on port 1234 in a new terminal to simulate a server:
        ```console
        $ while true; do { echo -e 'HTTP/0 200 OK\r\n'; } | nc -l 1234; done
        ```
        The server returns an invalid HTTP version on purpose.
    4. Try to fetch a package, e.g. `pixelcannon`:
       ```console
       $ cargo run -- fetch pixelcannon
       ```
    5. Notice that you get the following error message with or without the changes:
       ```console
       * Requesting http://localhost:1234/x86_64-unknown-linux-gnu/pixelcannon.sig
       pkg: fetch: pixelcannon: failed: Invalid HTTP version specified
       ```
    
    [1]: https://blog.rust-lang.org/2020/03/12/Rust-1.42.html#errordescription-is-deprecated
    5a6dcad4
    History
    Fix description deprecation warnings
    Michael McDonnell authored
    The `description` and `cause` methods in `Error` were soft deprecated in Rust 1.27 and hard deprecated in Rust 1.42 [[1]]. This change removes the use of these deprecated methods and fixes three deprecation warnings.
    
    You can verify that the test output has not changed with the following steps:
    
    1. Create the file `/etc/pkg.d/localtest`
    2. Add the line `localhost:1234` to `/etc/pkg.d/localtest`
    3. Run Netcat on port 1234 in a new terminal to simulate a server:
        ```console
        $ while true; do { echo -e 'HTTP/0 200 OK\r\n'; } | nc -l 1234; done
        ```
        The server returns an invalid HTTP version on purpose.
    4. Try to fetch a package, e.g. `pixelcannon`:
       ```console
       $ cargo run -- fetch pixelcannon
       ```
    5. Notice that you get the following error message with or without the changes:
       ```console
       * Requesting http://localhost:1234/x86_64-unknown-linux-gnu/pixelcannon.sig
       pkg: fetch: pixelcannon: failed: Invalid HTTP version specified
       ```
    
    [1]: https://blog.rust-lang.org/2020/03/12/Rust-1.42.html#errordescription-is-deprecated