impl Unborrow for &'a mut T
This plays nicer with user code that's generic over peripheral traits like `Instance` or `Pin`.
This commit is contained in:
		@@ -24,14 +24,6 @@ macro_rules! peripherals {
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $(#[$cfg])?
 | 
			
		||||
                impl embassy::util::Unborrow for &mut $name {
 | 
			
		||||
                    type Target = $name;
 | 
			
		||||
                    #[inline]
 | 
			
		||||
                    unsafe fn unborrow(self) -> $name {
 | 
			
		||||
                        ::core::ptr::read(self)
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            )*
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -95,14 +87,6 @@ macro_rules! impl_unborrow {
 | 
			
		||||
                self
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        impl<'a> ::embassy::util::Unborrow for &'a mut $type {
 | 
			
		||||
            type Target = $type;
 | 
			
		||||
            #[inline]
 | 
			
		||||
            unsafe fn unborrow(self) -> Self::Target {
 | 
			
		||||
                unsafe { ::core::ptr::read(self) }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user