Repository: Orange-OpenSource/hurl
File: packages/hurl/src/runner/runner_options.rs (Rust)

Code before:
    /// Sets maximum time allowed for the transfer.
    pub(crate) timeout: Duration,
    /// Executes Hurl file to to_entry (starting at 1), ignores the remaining of the file.
    pub(crate) to_entry: Option<usize>,
    /// Sets the specified unix domain socket to connect through, instead of using the network.
    pub(crate) unix_socket: Option<String>,
    /// Adds basic Authentication header to each request.
    pub(crate) user: Option<String>,
    /// Specifies the User-Agent string to send to the HTTP server.
    pub(crate) user_agent: Option<String>,
}

impl Default for RunnerOptions {
    fn default() -> Self {
        RunnerOptionsBuilder::default().build()
    }
}

// FIXME: Remove this manual implementation in favour of a derive
// when we have removed the `post_entry` and `pre_entry` fields
// (which for the time being had to be left out of a derived comparison)
// due to the `function pointer comparisons do not produce meaningful results` error.
// See https://github.com/Orange-OpenSource/hurl/issues/3763 and https://github.com/Orange-OpenSource/hurl/pull/4232.
impl PartialEq for RunnerOptions {
    fn eq(&self, other: &Self) -> bool {
        self.allow_reuse == other.allow_reuse
            && self.aws_sigv4 == other.aws_sigv4
            && self.cacert_file == other.cacert_file
            && self.client_cert_file == other.client_cert_file
            && self.client_key_file == other.client_key_file
            && self.compressed == other.compressed
            && self.connect_timeout == other.connect_timeout
            && self.connects_to == other.connects_to
            && self.delay == other.delay
            && self.context_dir == other.context_dir
            && self.continue_on_error == other.continue_on_error
            && self.cookie_input_file == other.cookie_input_file
            && self.follow_location == other.follow_location
            && self.follow_location_trusted == other.follow_location_trusted
            && self.from_entry == other.from_entry
            && self.headers == other.headers
            && self.http_version == other.http_version
            && self.ignore_asserts == other.ignore_asserts
            && self.ip_resolve == other.ip_resolve
            && self.insecure == other.insecure
            && self.max_filesize == other.max_filesize
            && self.max_recv_speed == other.max_recv_speed
            && self.max_redirect == other.max_redirect
            && self.max_send_speed == other.max_send_speed
            && self.netrc == other.netrc
            && self.netrc_file == other.netrc_file

Review comment (suggestion):
Maybe we can bind `other.allow_reuse` to local variable, this way if we add a new field to `RunnerOptions` th compiler will complain:

```rust
    fn eq(&self, other: &Self) -> bool {
        let RunnerOptions {
            allow_reuse,
            aws_sigv4,
            cacert_file,
            client_cert_file,
            client_key_file,
            compressed,
            connect_timeout,
            connects_to,
            delay,
            context_dir,
            continue_on_error,
            cookie_input_file,
            follow_location,
            follow_location_trusted,
            from_entry,
            headers,
            http_version,
            ignore_asserts,
            ip_resolve,
            insecure,
            max_filesize,
            max_recv_speed,
            max_redirect,
            max_send_speed,
            netrc,
            netrc_file,
            netrc_optional,
            no_proxy,
            output,
            path_as_is,
            pinned_pub_key,
            post_entry: _,
            pre_entry: _,
            proxy,
            repeat,
            resolves,
            retry,
            retry_interval,
            skip,
            ssl_no_revoke,
            timeout,
            to_entry,
            unix_socket,
            user,
            user_agent,
        } = other;

        &self.allow_reuse == allow_reuse
            && &self.aws_sigv4 == aws_sigv4
            && &self.cacert_file == cacert_file
            && &self.client_cert_file == client_cert_file
            // etc....
```

Code after:
    /// Sets maximum time allowed for the transfer.
    pub(crate) timeout: Duration,
    /// Executes Hurl file to to_entry (starting at 1), ignores the remaining of the file.
    pub(crate) to_entry: Option<usize>,
    /// Sets the specified unix domain socket to connect through, instead of using the network.
    pub(crate) unix_socket: Option<String>,
    /// Adds basic Authentication header to each request.
    pub(crate) user: Option<String>,
    /// Specifies the User-Agent string to send to the HTTP server.
    pub(crate) user_agent: Option<String>,
}

impl Default for RunnerOptions {
    fn default() -> Self {
        RunnerOptionsBuilder::default().build()
    }
}

// FIXME: Remove this manual implementation in favour of a derive
// when we have removed the `post_entry` and `pre_entry` fields,
// which for the time being had to be left out of a derived comparison
// due to the `function pointer comparisons do not produce meaningful results` error.
// See https://github.com/Orange-OpenSource/hurl/issues/3763 and https://github.com/Orange-OpenSource/hurl/pull/4232.
impl PartialEq for RunnerOptions {
    fn eq(&self, other: &Self) -> bool {
        let Self {
            allow_reuse,
            aws_sigv4,
            cacert_file,
            client_cert_file,
            client_key_file,
            compressed,
            connect_timeout,
            connects_to,
            delay,
            context_dir,
            continue_on_error,
            cookie_input_file,
            follow_location,
            follow_location_trusted,
            from_entry,
            headers,
            http_version,
            ignore_asserts,
            ip_resolve,
            insecure,
            max_filesize,
            max_recv_speed,
            max_redirect,
            max_send_speed,
            netrc,