Closed Bug 1492652 Opened 6 years ago Closed 6 years ago

Avoid cloning of log level when initialising logging

Categories

(Testing :: geckodriver, enhancement, P1)

enhancement

Tracking

(firefox64 fixed)

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: ato, Assigned: ato)

Details

Attachments

(1 file)

In geckodriver we clone the log level when calling logging::init_with_level,
but since it implements the Copy trait we can get away with simply
dereferencing it.
Assignee: nobody → ato
Status: NEW → ASSIGNED
Priority: -- → P1
Instead of cloning we can dereference the logging level since it
derives the Copy trait.
Attachment #9010489 - Flags: review?(hskupin)
Comment on attachment 9010489 [details] [diff] [review]
geckodriver: avoid cloning log level on init

Review of attachment 9010489 [details] [diff] [review]:
-----------------------------------------------------------------

I would like to forward this to James, given that I miss the connection between Copy and Clone here, and which side-effects this could have.
Attachment #9010489 - Flags: review?(hskupin) → review?(james)
Attachment #9010489 - Flags: review?(james) → review+
Pushed by ato@sny.no:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f9d053ee3931
geckodriver: avoid cloning log level on init; r=jgraham
Comment on attachment 9010489 [details] [diff] [review]
geckodriver: avoid cloning log level on init

Review of attachment 9010489 [details] [diff] [review]:
-----------------------------------------------------------------

::: testing/geckodriver/src/main.rs
@@ +179,5 @@
>              _ => Some(logging::Level::Trace),
>          }
>      };
>      if let Some(ref level) = log_level {
> +        logging::init_with_level(*level).unwrap();

Could have been

if let Some(level) = log_level {
    logging::init_with_level(level).unwrap();
}
https://hg.mozilla.org/mozilla-central/rev/f9d053ee3931
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: