Closed Bug 1487986 Opened 2 years ago Closed 2 years ago

webdriver: Prefer x.is_empty() over x.len() == 0

Categories

(Testing :: geckodriver, enhancement)

enhancement
Not set

Tracking

(firefox64 fixed)

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: ato, Assigned: ato)

Details

Attachments

(1 file, 1 obsolete file)

It is considered better Rust style to use x.is_empty() over x.len()
== 0, so we should do that.
Assignee: nobody → ato
Status: NEW → ASSIGNED
Attachment #9005815 - Flags: review?(hskupin)
Comment on attachment 9005815 [details] [diff] [review]
webdriver: prefer x.is_empty() over x.len() == 0

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

::: testing/webdriver/src/capabilities.rs
@@ +387,5 @@
>          &self,
>          browser_capabilities: &mut T,
>      ) -> WebDriverResult<Option<Capabilities>> {
>          let default = vec![Map::new()];
> +        let capabilities_list = if self.firstMatch.is_empty() {

You reverse the condition here, which should fail the wdspec tests too.
Attachment #9005815 - Flags: review?(hskupin) → review-
Attachment #9005815 - Attachment is obsolete: true
Attachment #9005987 - Flags: review?(hskupin)
Pushed by ato@sny.no:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ecdba8d9bb22
webdriver: prefer x.is_empty() over x.len() == 0; r=whimboo
https://hg.mozilla.org/mozilla-central/rev/ecdba8d9bb22
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
Target Milestone: mozilla64 → mozilla63
Target Milestone: mozilla63 → mozilla64
You need to log in before you can comment on or make changes to this bug.