mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
fixed various clippy warnings (#31954)
This commit is contained in:
parent
c3360df918
commit
bd287df0d4
6 changed files with 6 additions and 6 deletions
|
@ -258,7 +258,7 @@ impl AudioNodeMethods for AudioNode {
|
|||
EventTargetTypeId::AudioNode(AudioNodeTypeId::AudioDestinationNode) => {
|
||||
if self.context.is_offline() {
|
||||
return Err(Error::InvalidState);
|
||||
} else if value < 1 || value > MAX_CHANNEL_COUNT {
|
||||
} else if !(1..=MAX_CHANNEL_COUNT).contains(&value) {
|
||||
return Err(Error::IndexSize);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -197,7 +197,7 @@ pub unsafe fn get_array_index_from_id(_cx: *mut JSContext, id: HandleId) -> Opti
|
|||
let first_char = char::decode_utf16(chars.iter().cloned())
|
||||
.next()
|
||||
.map_or('\0', |r| r.unwrap_or('\0'));
|
||||
if !('a'..='z').contains(&first_char) {
|
||||
if !first_char.is_ascii_lowercase() {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
|
|
@ -322,5 +322,5 @@ pub fn normalize_type_string(s: &str) -> String {
|
|||
fn is_ascii_printable(string: &str) -> bool {
|
||||
// Step 5.1 in Sec 5.1 of File API spec
|
||||
// <https://w3c.github.io/FileAPI/#constructorBlob>
|
||||
string.chars().all(|c| c >= '\x20' && c <= '\x7E')
|
||||
string.chars().all(|c| ('\x20'..='\x7E').contains(&c))
|
||||
}
|
||||
|
|
|
@ -523,7 +523,7 @@ const BLUETOOTH_ASSIGNED_CHARCTERISTICS: &[(&str, u32)] = &[
|
|||
];
|
||||
|
||||
//https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx
|
||||
const BLUETOOTH_ASSIGNED_DESCRIPTORS: &'static [(&str, u32)] = &[
|
||||
const BLUETOOTH_ASSIGNED_DESCRIPTORS: &[(&str, u32)] = &[
|
||||
(
|
||||
"org.bluetooth.descriptor.gatt.characteristic_extended_properties",
|
||||
0x2900_u32,
|
||||
|
|
|
@ -148,7 +148,7 @@ impl CharacterDataMethods for CharacterData {
|
|||
Err(()) => substring += remaining,
|
||||
// Steps 4.
|
||||
Ok((s, astral, _)) => {
|
||||
substring = substring + s;
|
||||
substring += s;
|
||||
// As if we had split the UTF-16 surrogate pair in half
|
||||
// and then transcoded that to UTF-8 lossily,
|
||||
// since our DOMString is currently strict UTF-8.
|
||||
|
|
|
@ -57,7 +57,7 @@ impl CSSNamespaceRuleMethods for CSSNamespaceRule {
|
|||
.prefix
|
||||
.as_ref()
|
||||
.map(|s| s.to_string().into())
|
||||
.unwrap_or(DOMString::new())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssnamespacerule-namespaceuri
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue