Rust 1.85 (#25272)
Closes #ISSUE Release Notes: - N/A *or* Added/Fixed/Improved ... --------- Co-authored-by: Anthony Eid <hello@anthonyeid.me>
This commit is contained in:
co-authored by
Anthony Eid
parent
fc52b43159
commit
e4e758db3a
@@ -82,7 +82,7 @@ impl AppCell {
|
||||
#[derive(Deref, DerefMut)]
|
||||
pub struct AppRef<'a>(Ref<'a, App>);
|
||||
|
||||
impl<'a> Drop for AppRef<'a> {
|
||||
impl Drop for AppRef<'_> {
|
||||
fn drop(&mut self) {
|
||||
if option_env!("TRACK_THREAD_BORROWS").is_some() {
|
||||
let thread_id = std::thread::current().id();
|
||||
@@ -95,7 +95,7 @@ impl<'a> Drop for AppRef<'a> {
|
||||
#[derive(Deref, DerefMut)]
|
||||
pub struct AppRefMut<'a>(RefMut<'a, App>);
|
||||
|
||||
impl<'a> Drop for AppRefMut<'a> {
|
||||
impl Drop for AppRefMut<'_> {
|
||||
fn drop(&mut self) {
|
||||
if option_env!("TRACK_THREAD_BORROWS").is_some() {
|
||||
let thread_id = std::thread::current().id();
|
||||
|
||||
@@ -649,7 +649,7 @@ impl<'a, T: 'static> Context<'a, T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T> Context<'a, T> {
|
||||
impl<T> Context<'_, T> {
|
||||
/// Emit an event of the specified type, which can be handled by other entities that have subscribed via `subscribe` methods on their respective contexts.
|
||||
pub fn emit<Evt>(&mut self, event: Evt)
|
||||
where
|
||||
@@ -664,7 +664,7 @@ impl<'a, T> Context<'a, T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T> AppContext for Context<'a, T> {
|
||||
impl<T> AppContext for Context<'_, T> {
|
||||
type Result<U> = U;
|
||||
|
||||
fn new<U: 'static>(
|
||||
|
||||
@@ -191,7 +191,7 @@ pub(crate) struct Lease<'a, T> {
|
||||
entity_type: PhantomData<T>,
|
||||
}
|
||||
|
||||
impl<'a, T: 'static> core::ops::Deref for Lease<'a, T> {
|
||||
impl<T: 'static> core::ops::Deref for Lease<'_, T> {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
@@ -199,13 +199,13 @@ impl<'a, T: 'static> core::ops::Deref for Lease<'a, T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: 'static> core::ops::DerefMut for Lease<'a, T> {
|
||||
impl<T: 'static> core::ops::DerefMut for Lease<'_, T> {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
self.entity.as_mut().unwrap().downcast_mut().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T> Drop for Lease<'a, T> {
|
||||
impl<T> Drop for Lease<'_, T> {
|
||||
fn drop(&mut self) {
|
||||
if self.entity.is_some() && !panicking() {
|
||||
panic!("Leases must be ended with EntityMap::end_lease")
|
||||
|
||||
@@ -82,7 +82,7 @@ impl From<Rgba> for u32 {
|
||||
|
||||
struct RgbaVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for RgbaVisitor {
|
||||
impl Visitor<'_> for RgbaVisitor {
|
||||
type Value = Rgba;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
@@ -180,7 +180,7 @@ impl TryFrom<&'_ str> for Rgba {
|
||||
/// Duplicates a given hex digit.
|
||||
/// E.g., `0xf` -> `0xff`.
|
||||
const fn duplicate(value: u8) -> u8 {
|
||||
value << 4 | value
|
||||
(value << 4) | value
|
||||
}
|
||||
|
||||
(duplicate(r), duplicate(g), duplicate(b), duplicate(a))
|
||||
|
||||
@@ -946,13 +946,13 @@ impl<'a> sum_tree::Dimension<'a, ListItemSummary> for Height {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> sum_tree::SeekTarget<'a, ListItemSummary, ListItemSummary> for Count {
|
||||
impl sum_tree::SeekTarget<'_, ListItemSummary, ListItemSummary> for Count {
|
||||
fn cmp(&self, other: &ListItemSummary, _: &()) -> std::cmp::Ordering {
|
||||
self.0.partial_cmp(&other.count).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> sum_tree::SeekTarget<'a, ListItemSummary, ListItemSummary> for Height {
|
||||
impl sum_tree::SeekTarget<'_, ListItemSummary, ListItemSummary> for Height {
|
||||
fn cmp(&self, other: &ListItemSummary, _: &()) -> std::cmp::Ordering {
|
||||
self.0.partial_cmp(&other.height).unwrap()
|
||||
}
|
||||
|
||||
@@ -587,7 +587,7 @@ impl<'a> Scope<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Drop for Scope<'a> {
|
||||
impl Drop for Scope<'_> {
|
||||
fn drop(&mut self) {
|
||||
self.tx.take().unwrap();
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ use objc::{class, msg_send, sel, sel_impl};
|
||||
/// The `cocoa` crate does not define NSAttributedString (and related Cocoa classes),
|
||||
/// which are needed for copying rich text (that is, text intermingled with images)
|
||||
/// to the clipboard. This adds access to those APIs.
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub trait NSAttributedString: Sized {
|
||||
unsafe fn alloc(_: Self) -> id {
|
||||
|
||||
@@ -26,7 +26,7 @@ pub(crate) mod dispatch_sys {
|
||||
|
||||
use dispatch_sys::*;
|
||||
pub(crate) fn dispatch_get_main_queue() -> dispatch_queue_t {
|
||||
unsafe { addr_of!(_dispatch_main_q) as *const _ as dispatch_queue_t }
|
||||
addr_of!(_dispatch_main_q) as *const _ as dispatch_queue_t
|
||||
}
|
||||
|
||||
pub(crate) struct MacDispatcher {
|
||||
|
||||
@@ -1221,10 +1221,10 @@ fn set_window_composition_attribute(hwnd: HWND, color: Option<Color>, state: u32
|
||||
unsafe {
|
||||
type SetWindowCompositionAttributeType =
|
||||
unsafe extern "system" fn(HWND, *mut WINDOWCOMPOSITIONATTRIBDATA) -> BOOL;
|
||||
let module_name = PCSTR::from_raw("user32.dll\0".as_ptr());
|
||||
let module_name = PCSTR::from_raw(c"user32.dll".as_ptr() as *const u8);
|
||||
let user32 = GetModuleHandleA(module_name);
|
||||
if user32.is_ok() {
|
||||
let func_name = PCSTR::from_raw("SetWindowCompositionAttribute\0".as_ptr());
|
||||
let func_name = PCSTR::from_raw(c"SetWindowCompositionAttribute".as_ptr() as *const u8);
|
||||
let set_window_composition_attribute: SetWindowCompositionAttributeType =
|
||||
std::mem::transmute(GetProcAddress(user32.unwrap(), func_name));
|
||||
let mut color = color.unwrap_or_default();
|
||||
@@ -1238,7 +1238,7 @@ fn set_window_composition_attribute(hwnd: HWND, color: Option<Color>, state: u32
|
||||
gradient_color: (color.0 as u32)
|
||||
| ((color.1 as u32) << 8)
|
||||
| ((color.2 as u32) << 16)
|
||||
| (color.3 as u32) << 24,
|
||||
| ((color.3 as u32) << 24),
|
||||
animation_id: 0,
|
||||
};
|
||||
let mut data = WINDOWCOMPOSITIONATTRIBDATA {
|
||||
|
||||
@@ -670,6 +670,15 @@ pub struct TextRun {
|
||||
pub strikethrough: Option<StrikethroughStyle>,
|
||||
}
|
||||
|
||||
#[cfg(all(target_os = "macos", test))]
|
||||
impl TextRun {
|
||||
fn with_len(&self, len: usize) -> Self {
|
||||
let mut this = self.clone();
|
||||
this.len = len;
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
/// An identifier for a specific glyph, as returned by [`TextSystem::layout_line`].
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
||||
#[repr(C)]
|
||||
|
||||
@@ -601,15 +601,15 @@ struct CacheKeyRef<'a> {
|
||||
wrap_width: Option<Pixels>,
|
||||
}
|
||||
|
||||
impl<'a> PartialEq for (dyn AsCacheKeyRef + 'a) {
|
||||
impl PartialEq for (dyn AsCacheKeyRef + '_) {
|
||||
fn eq(&self, other: &dyn AsCacheKeyRef) -> bool {
|
||||
self.as_cache_key_ref() == other.as_cache_key_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Eq for (dyn AsCacheKeyRef + 'a) {}
|
||||
impl Eq for (dyn AsCacheKeyRef + '_) {}
|
||||
|
||||
impl<'a> Hash for (dyn AsCacheKeyRef + 'a) {
|
||||
impl Hash for (dyn AsCacheKeyRef + '_) {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.as_cache_key_ref().hash(state)
|
||||
}
|
||||
@@ -644,7 +644,7 @@ impl<'a> Borrow<dyn AsCacheKeyRef + 'a> for Arc<CacheKey> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> AsCacheKeyRef for CacheKeyRef<'a> {
|
||||
impl AsCacheKeyRef for CacheKeyRef<'_> {
|
||||
fn as_cache_key_ref(&self) -> CacheKeyRef {
|
||||
*self
|
||||
}
|
||||
|
||||
@@ -543,14 +543,6 @@ mod tests {
|
||||
background_color: None,
|
||||
};
|
||||
|
||||
impl TextRun {
|
||||
fn with_len(&self, len: usize) -> Self {
|
||||
let mut this = self.clone();
|
||||
this.len = len;
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
let text = "aa bbb cccc ddddd eeee".into();
|
||||
let lines = text_system
|
||||
.shape_text(
|
||||
|
||||
@@ -72,7 +72,7 @@ where
|
||||
pub struct CwdBacktrace<'a>(pub &'a backtrace::Backtrace);
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
impl<'a> std::fmt::Debug for CwdBacktrace<'a> {
|
||||
impl std::fmt::Debug for CwdBacktrace<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
use backtrace::{BacktraceFmt, BytesOrWideString};
|
||||
|
||||
|
||||
@@ -3689,8 +3689,6 @@ impl Window {
|
||||
dispatch_tree.bindings_for_action(action, &[context])
|
||||
}
|
||||
|
||||
/// Returns a generic event listener that invokes the given listener with the view and context associated with the given view handle.
|
||||
|
||||
/// Returns a generic event listener that invokes the given listener with the view and context associated with the given view handle.
|
||||
pub fn listener_for<V: Render, E>(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user