Skip to content

Commit

Permalink
Replace borrow_mut with borrow where possible
Browse files Browse the repository at this point in the history
also fixes some clippy warnings

Co-authored-by: grovesNL <[email protected]>
Signed-off-by: sagudev <[email protected]>
  • Loading branch information
sagudev and grovesNL committed Oct 1, 2024
1 parent 57995d9 commit c63b514
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/web_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1712,8 +1712,8 @@ impl HasContext for Context {
}

unsafe fn is_shader(&self, shader: Self::Shader) -> bool {
let shaders = self.shaders.borrow_mut();
if let Some(ref s) = shaders.get(shader) {
let shaders = self.shaders.borrow();
if let Some(s) = shaders.get(shader) {
match self.raw {
RawRenderingContext::WebGl1(ref gl) => gl.is_shader(Some(s)),
RawRenderingContext::WebGl2(ref gl) => gl.is_shader(Some(s)),
Expand Down Expand Up @@ -1743,8 +1743,8 @@ impl HasContext for Context {
}

unsafe fn is_texture(&self, texture: Self::Texture) -> bool {
let textures = self.textures.borrow_mut();
if let Some(ref t) = textures.get(texture) {
let textures = self.textures.borrow();
if let Some(t) = textures.get(texture) {
match self.raw {
RawRenderingContext::WebGl1(ref gl) => gl.is_texture(Some(t)),
RawRenderingContext::WebGl2(ref gl) => gl.is_texture(Some(t)),
Expand Down Expand Up @@ -1852,8 +1852,8 @@ impl HasContext for Context {
}

unsafe fn is_program(&self, program: Self::Program) -> bool {
let programs = self.programs.borrow_mut();
if let Some(ref p) = programs.get(program) {
let programs = self.programs.borrow();
if let Some(p) = programs.get(program) {
match self.raw {
RawRenderingContext::WebGl1(ref gl) => gl.is_program(Some(p)),
RawRenderingContext::WebGl2(ref gl) => gl.is_program(Some(p)),
Expand Down Expand Up @@ -2365,8 +2365,8 @@ impl HasContext for Context {
}

unsafe fn is_buffer(&self, buffer: Self::Buffer) -> bool {
let buffers = self.buffers.borrow_mut();
if let Some(ref b) = buffers.get(buffer) {
let buffers = self.buffers.borrow();
if let Some(b) = buffers.get(buffer) {
match self.raw {
RawRenderingContext::WebGl1(ref gl) => gl.is_buffer(Some(b)),
RawRenderingContext::WebGl2(ref gl) => gl.is_buffer(Some(b)),
Expand Down

0 comments on commit c63b514

Please sign in to comment.