diff options
-rw-r--r-- | components/script/body.rs | 5 | ||||
-rw-r--r-- | components/script/dom/baseaudiocontext.rs | 6 | ||||
-rw-r--r-- | components/script/dom/blob.rs | 3 | ||||
-rw-r--r-- | components/script/dom/cssstyledeclaration.rs | 3 | ||||
-rw-r--r-- | components/script/dom/globalscope.rs | 5 | ||||
-rw-r--r-- | components/script/dom/mediasession.rs | 5 | ||||
-rw-r--r-- | components/script/dom/rtcdatachannel.rs | 6 | ||||
-rw-r--r-- | components/script/dom/webgl2renderingcontext.rs | 15 |
8 files changed, 17 insertions, 31 deletions
diff --git a/components/script/body.rs b/components/script/body.rs index 36c6d3cc8b4..7971817747b 100644 --- a/components/script/body.rs +++ b/components/script/body.rs @@ -751,10 +751,7 @@ fn consume_body_with_promise<T: BodyMixin + DomObject>( // Step 2. let stream = match object.body() { Some(stream) => stream, - None => { - let stream = ReadableStream::new_from_bytes(&global, Vec::with_capacity(0)); - stream - }, + None => ReadableStream::new_from_bytes(&global, Vec::with_capacity(0)), }; // Step 3. diff --git a/components/script/dom/baseaudiocontext.rs b/components/script/dom/baseaudiocontext.rs index 462274bb685..e47e2e02b95 100644 --- a/components/script/dom/baseaudiocontext.rs +++ b/components/script/dom/baseaudiocontext.rs @@ -122,7 +122,7 @@ impl BaseAudioContext { let client_context_id = ClientContextId::build(pipeline_id.namespace_id.0, pipeline_id.index.0.get()); - let context = BaseAudioContext { + BaseAudioContext { eventtarget: EventTarget::new_inherited(), audio_context_impl: ServoMedia::get() .unwrap() @@ -135,9 +135,7 @@ impl BaseAudioContext { sample_rate, state: Cell::new(AudioContextState::Suspended), channel_count: channel_count.into(), - }; - - context + } } /// Tells whether this is an OfflineAudioContext or not. diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index af45c1e858c..a49d317031b 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -309,11 +309,10 @@ impl BlobMethods for Blob { /// see <https://github.com/w3c/FileAPI/issues/43> pub fn normalize_type_string(s: &str) -> String { if is_ascii_printable(s) { - let s_lower = s.to_ascii_lowercase(); + s.to_ascii_lowercase() // match s_lower.parse() as Result<Mime, ()> { // Ok(_) => s_lower, // Err(_) => "".to_string() - s_lower } else { "".to_string() } diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index 2d5015648d9..e05a611940c 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -73,8 +73,7 @@ impl CSSStyleOwner { let lock = attr.as_ref().unwrap(); let mut guard = shared_lock.write(); let pdb = lock.write_with(&mut guard); - let result = f(pdb, &mut changed); - result + f(pdb, &mut changed) } else { let mut pdb = PropertyDeclarationBlock::new(); let result = f(&mut pdb, &mut changed); diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index 8f91aea597e..7072a7114f9 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -2771,7 +2771,7 @@ impl GlobalScope { return p; } - let promise = match image { + match image { ImageBitmapSource::HTMLCanvasElement(ref canvas) => { // https://html.spec.whatwg.org/multipage/#check-the-usability-of-the-image-argument if !canvas.is_valid() { @@ -2815,8 +2815,7 @@ impl GlobalScope { p.reject_error(Error::NotSupported); return p; }, - }; - promise + } } pub fn fire_timer(&self, handle: TimerEventId) { diff --git a/components/script/dom/mediasession.rs b/components/script/dom/mediasession.rs index fde228f48d5..1f0e3392436 100644 --- a/components/script/dom/mediasession.rs +++ b/components/script/dom/mediasession.rs @@ -50,14 +50,13 @@ pub struct MediaSession { impl MediaSession { #[allow(crown::unrooted_must_root)] fn new_inherited() -> MediaSession { - let media_session = MediaSession { + MediaSession { reflector_: Reflector::new(), metadata: DomRefCell::new(None), playback_state: DomRefCell::new(MediaSessionPlaybackState::None), action_handlers: DomRefCell::new(HashMapTracedValues::new()), media_instance: Default::default(), - }; - media_session + } } pub fn new(window: &Window) -> DomRoot<MediaSession> { diff --git a/components/script/dom/rtcdatachannel.rs b/components/script/dom/rtcdatachannel.rs index 36c1cab92db..63f9a5e111d 100644 --- a/components/script/dom/rtcdatachannel.rs +++ b/components/script/dom/rtcdatachannel.rs @@ -72,7 +72,7 @@ impl RTCDataChannel { .expect("Expected data channel id"), ); - let channel = RTCDataChannel { + RTCDataChannel { eventtarget: EventTarget::new_inherited(), servo_media_id, peer_connection: Dom::from_ref(peer_connection), @@ -85,9 +85,7 @@ impl RTCDataChannel { id: options.id, ready_state: Cell::new(RTCDataChannelState::Connecting), binary_type: DomRefCell::new(DOMString::from("blob")), - }; - - channel + } } pub fn new( diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs index 0ec8d919317..bfd972b8c20 100644 --- a/components/script/dom/webgl2renderingcontext.rs +++ b/components/script/dom/webgl2renderingcontext.rs @@ -427,10 +427,9 @@ impl WebGL2RenderingContext { let last_row_bytes = bytes_per_pixel .checked_mul(width as usize) .ok_or(InvalidOperation)?; - let result = full_row_bytes + full_row_bytes .checked_add(last_row_bytes) - .ok_or(InvalidOperation)?; - result + .ok_or(InvalidOperation)? }; let skipped_bytes = { let skipped_row_bytes = self @@ -443,10 +442,9 @@ impl WebGL2RenderingContext { .get() .checked_mul(bytes_per_pixel) .ok_or(InvalidOperation)?; - let result = skipped_row_bytes + skipped_row_bytes .checked_add(skipped_pixel_bytes) - .ok_or(InvalidOperation)?; - result + .ok_or(InvalidOperation)? }; Ok(ReadPixelsSizes { row_stride, @@ -4119,12 +4117,11 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { self.base.validate_ownership(program), return constants::INVALID_INDEX ); - let index = handle_potential_webgl_error!( + handle_potential_webgl_error!( self.base, program.get_uniform_block_index(block_name), return constants::INVALID_INDEX - ); - index + ) } /// <https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.16> |