Fix some clippy issues found by 1.84.0 (#5603)
This commit is contained in:
parent
1339639706
commit
164f56f554
|
|
@ -878,20 +878,6 @@ pub trait Storage {
|
||||||
fn flush(&mut self);
|
fn flush(&mut self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Stores nothing.
|
|
||||||
#[derive(Clone, Default)]
|
|
||||||
pub(crate) struct DummyStorage {}
|
|
||||||
|
|
||||||
impl Storage for DummyStorage {
|
|
||||||
fn get_string(&self, _key: &str) -> Option<String> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn set_string(&mut self, _key: &str, _value: String) {}
|
|
||||||
|
|
||||||
fn flush(&mut self) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get and deserialize the [RON](https://github.com/ron-rs/ron) stored at the given key.
|
/// Get and deserialize the [RON](https://github.com/ron-rs/ron) stored at the given key.
|
||||||
#[cfg(feature = "ron")]
|
#[cfg(feature = "ron")]
|
||||||
pub fn get_value<T: serde::de::DeserializeOwned>(storage: &dyn Storage, key: &str) -> Option<T> {
|
pub fn get_value<T: serde::de::DeserializeOwned>(storage: &dyn Storage, key: &str) -> Option<T> {
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,7 @@ impl<'app> GlowWinitApp<'app> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'app> WinitApp for GlowWinitApp<'app> {
|
impl WinitApp for GlowWinitApp<'_> {
|
||||||
fn egui_ctx(&self) -> Option<&egui::Context> {
|
fn egui_ctx(&self) -> Option<&egui::Context> {
|
||||||
self.running.as_ref().map(|r| &r.integration.egui_ctx)
|
self.running.as_ref().map(|r| &r.integration.egui_ctx)
|
||||||
}
|
}
|
||||||
|
|
@ -479,7 +479,7 @@ impl<'app> WinitApp for GlowWinitApp<'app> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'app> GlowWinitRunning<'app> {
|
impl GlowWinitRunning<'_> {
|
||||||
fn run_ui_and_paint(
|
fn run_ui_and_paint(
|
||||||
&mut self,
|
&mut self,
|
||||||
event_loop: &ActiveEventLoop,
|
event_loop: &ActiveEventLoop,
|
||||||
|
|
|
||||||
|
|
@ -323,7 +323,7 @@ impl<'app> WgpuWinitApp<'app> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'app> WinitApp for WgpuWinitApp<'app> {
|
impl WinitApp for WgpuWinitApp<'_> {
|
||||||
fn egui_ctx(&self) -> Option<&egui::Context> {
|
fn egui_ctx(&self) -> Option<&egui::Context> {
|
||||||
self.running.as_ref().map(|r| &r.integration.egui_ctx)
|
self.running.as_ref().map(|r| &r.integration.egui_ctx)
|
||||||
}
|
}
|
||||||
|
|
@ -487,7 +487,7 @@ impl<'app> WinitApp for WgpuWinitApp<'app> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'app> WgpuWinitRunning<'app> {
|
impl WgpuWinitRunning<'_> {
|
||||||
fn save_and_destroy(&mut self) {
|
fn save_and_destroy(&mut self) {
|
||||||
profiling::function_scope!();
|
profiling::function_scope!();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ impl WgpuSetup {
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
if backends.contains(wgpu::Backends::BROWSER_WEBGPU) {
|
if backends.contains(wgpu::Backends::BROWSER_WEBGPU) {
|
||||||
let is_secure_context =
|
let is_secure_context =
|
||||||
wgpu::web_sys::window().map_or(false, |w| w.is_secure_context());
|
wgpu::web_sys::window().is_some_and(|w| w.is_secure_context());
|
||||||
if !is_secure_context {
|
if !is_secure_context {
|
||||||
log::info!(
|
log::info!(
|
||||||
"WebGPU is only available in secure contexts, i.e. on HTTPS and on localhost."
|
"WebGPU is only available in secure contexts, i.e. on HTTPS and on localhost."
|
||||||
|
|
|
||||||
|
|
@ -283,7 +283,7 @@ pub struct HeaderResponse<'ui, HeaderRet> {
|
||||||
header_response: InnerResponse<HeaderRet>,
|
header_response: InnerResponse<HeaderRet>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ui, HeaderRet> HeaderResponse<'ui, HeaderRet> {
|
impl<HeaderRet> HeaderResponse<'_, HeaderRet> {
|
||||||
pub fn is_open(&self) -> bool {
|
pub fn is_open(&self) -> bool {
|
||||||
self.state.is_open()
|
self.state.is_open()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1184,7 +1184,7 @@ impl Prepared {
|
||||||
&& ui.input(|i| {
|
&& ui.input(|i| {
|
||||||
i.pointer
|
i.pointer
|
||||||
.latest_pos()
|
.latest_pos()
|
||||||
.map_or(false, |p| handle_rect.contains(p))
|
.is_some_and(|p| handle_rect.contains(p))
|
||||||
});
|
});
|
||||||
let visuals = ui.visuals();
|
let visuals = ui.visuals();
|
||||||
if response.is_pointer_button_down_on() {
|
if response.is_pointer_button_down_on() {
|
||||||
|
|
|
||||||
|
|
@ -415,7 +415,7 @@ impl<'open> Window<'open> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'open> Window<'open> {
|
impl Window<'_> {
|
||||||
/// Returns `None` if the window is not open (if [`Window::open`] was called with `&mut false`).
|
/// Returns `None` if the window is not open (if [`Window::open`] was called with `&mut false`).
|
||||||
/// Returns `Some(InnerResponse { inner: None })` if the window is collapsed.
|
/// Returns `Some(InnerResponse { inner: None })` if the window is collapsed.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
||||||
|
|
@ -211,14 +211,14 @@ impl ContextImpl {
|
||||||
fn requested_immediate_repaint_prev_pass(&self, viewport_id: &ViewportId) -> bool {
|
fn requested_immediate_repaint_prev_pass(&self, viewport_id: &ViewportId) -> bool {
|
||||||
self.viewports
|
self.viewports
|
||||||
.get(viewport_id)
|
.get(viewport_id)
|
||||||
.map_or(false, |v| v.repaint.requested_immediate_repaint_prev_pass())
|
.is_some_and(|v| v.repaint.requested_immediate_repaint_prev_pass())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn has_requested_repaint(&self, viewport_id: &ViewportId) -> bool {
|
fn has_requested_repaint(&self, viewport_id: &ViewportId) -> bool {
|
||||||
self.viewports.get(viewport_id).map_or(false, |v| {
|
self.viewports
|
||||||
0 < v.repaint.outstanding || v.repaint.repaint_delay < Duration::MAX
|
.get(viewport_id)
|
||||||
})
|
.is_some_and(|v| 0 < v.repaint.outstanding || v.repaint.repaint_delay < Duration::MAX)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1214,7 +1214,7 @@ impl Context {
|
||||||
#[deprecated = "Use Response.contains_pointer or Context::read_response instead"]
|
#[deprecated = "Use Response.contains_pointer or Context::read_response instead"]
|
||||||
pub fn widget_contains_pointer(&self, id: Id) -> bool {
|
pub fn widget_contains_pointer(&self, id: Id) -> bool {
|
||||||
self.read_response(id)
|
self.read_response(id)
|
||||||
.map_or(false, |response| response.contains_pointer())
|
.is_some_and(|response| response.contains_pointer())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Do all interaction for an existing widget, without (re-)registering it.
|
/// Do all interaction for an existing widget, without (re-)registering it.
|
||||||
|
|
@ -2632,7 +2632,7 @@ impl Context {
|
||||||
pub fn is_context_menu_open(&self) -> bool {
|
pub fn is_context_menu_open(&self) -> bool {
|
||||||
self.data(|d| {
|
self.data(|d| {
|
||||||
d.get_temp::<crate::menu::BarState>(menu::CONTEXT_MENU_ID_STR.into())
|
d.get_temp::<crate::menu::BarState>(menu::CONTEXT_MENU_ID_STR.into())
|
||||||
.map_or(false, |state| state.has_root())
|
.is_some_and(|state| state.has_root())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -986,7 +986,7 @@ impl ModifierNames<'static> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ModifierNames<'a> {
|
impl ModifierNames<'_> {
|
||||||
pub fn format(&self, modifiers: &Modifiers, is_mac: bool) -> String {
|
pub fn format(&self, modifiers: &Modifiers, is_mac: bool) -> String {
|
||||||
let mut s = String::new();
|
let mut s = String::new();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ impl<'de> serde::Deserialize<'de> for UserData {
|
||||||
{
|
{
|
||||||
struct UserDataVisitor;
|
struct UserDataVisitor;
|
||||||
|
|
||||||
impl<'de> serde::de::Visitor<'de> for UserDataVisitor {
|
impl serde::de::Visitor<'_> for UserDataVisitor {
|
||||||
type Value = UserData;
|
type Value = UserData;
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ impl DragAndDrop {
|
||||||
pub fn has_any_payload(ctx: &Context) -> bool {
|
pub fn has_any_payload(ctx: &Context) -> bool {
|
||||||
ctx.data(|data| {
|
ctx.data(|data| {
|
||||||
let state = data.get_temp::<Self>(Id::NULL);
|
let state = data.get_temp::<Self>(Id::NULL);
|
||||||
state.map_or(false, |state| state.payload.is_some())
|
state.is_some_and(|state| state.payload.is_some())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1303,7 +1303,7 @@ impl PointerState {
|
||||||
self.started_decidedly_dragging
|
self.started_decidedly_dragging
|
||||||
&& !self.has_moved_too_much_for_a_click
|
&& !self.has_moved_too_much_for_a_click
|
||||||
&& self.button_down(PointerButton::Primary)
|
&& self.button_down(PointerButton::Primary)
|
||||||
&& self.press_start_time.map_or(false, |press_start_time| {
|
&& self.press_start_time.is_some_and(|press_start_time| {
|
||||||
self.time - press_start_time > self.input_options.max_click_duration
|
self.time - press_start_time > self.input_options.max_click_duration
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -679,7 +679,7 @@ impl MenuState {
|
||||||
|| self
|
|| self
|
||||||
.sub_menu
|
.sub_menu
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or(false, |(_, sub)| sub.read().area_contains(pos))
|
.is_some_and(|(_, sub)| sub.read().area_contains(pos))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn next_entry_index(&mut self) -> usize {
|
fn next_entry_index(&mut self) -> usize {
|
||||||
|
|
|
||||||
|
|
@ -618,7 +618,7 @@ impl Response {
|
||||||
let any_open_popups = self.ctx.prev_pass_state(|fs| {
|
let any_open_popups = self.ctx.prev_pass_state(|fs| {
|
||||||
fs.layers
|
fs.layers
|
||||||
.get(&self.layer_id)
|
.get(&self.layer_id)
|
||||||
.map_or(false, |layer| !layer.open_popups.is_empty())
|
.is_some_and(|layer| !layer.open_popups.is_empty())
|
||||||
});
|
});
|
||||||
if any_open_popups {
|
if any_open_popups {
|
||||||
// Hide tooltips if the user opens a popup (menu, combo-box, etc) in the same layer.
|
// Hide tooltips if the user opens a popup (menu, combo-box, etc) in the same layer.
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ impl LabelSelectionState {
|
||||||
let new_text_starts_with_space_or_punctuation = new_text
|
let new_text_starts_with_space_or_punctuation = new_text
|
||||||
.chars()
|
.chars()
|
||||||
.next()
|
.next()
|
||||||
.map_or(false, |c| c.is_whitespace() || c.is_ascii_punctuation());
|
.is_some_and(|c| c.is_whitespace() || c.is_ascii_punctuation());
|
||||||
|
|
||||||
if existing_ends_with_space == Some(false) && !new_text_starts_with_space_or_punctuation
|
if existing_ends_with_space == Some(false) && !new_text_starts_with_space_or_punctuation
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -229,13 +229,13 @@ impl UiStack {
|
||||||
/// Is this [`crate::Ui`] a panel?
|
/// Is this [`crate::Ui`] a panel?
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_panel_ui(&self) -> bool {
|
pub fn is_panel_ui(&self) -> bool {
|
||||||
self.kind().map_or(false, |kind| kind.is_panel())
|
self.kind().is_some_and(|kind| kind.is_panel())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is this [`crate::Ui`] an [`crate::Area`]?
|
/// Is this [`crate::Ui`] an [`crate::Area`]?
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_area_ui(&self) -> bool {
|
pub fn is_area_ui(&self) -> bool {
|
||||||
self.kind().map_or(false, |kind| kind.is_area())
|
self.kind().is_some_and(|kind| kind.is_area())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is this a root [`crate::Ui`], i.e. created with [`crate::Ui::new()`]?
|
/// Is this a root [`crate::Ui`], i.e. created with [`crate::Ui::new()`]?
|
||||||
|
|
@ -285,4 +285,4 @@ impl<'a> Iterator for UiStackIterator<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> FusedIterator for UiStackIterator<'a> {}
|
impl FusedIterator for UiStackIterator<'_> {}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ impl<'a> Checkbox<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for Checkbox<'a> {
|
impl Widget for Checkbox<'_> {
|
||||||
fn ui(self, ui: &mut Ui) -> Response {
|
fn ui(self, ui: &mut Ui) -> Response {
|
||||||
let Checkbox {
|
let Checkbox {
|
||||||
checked,
|
checked,
|
||||||
|
|
|
||||||
|
|
@ -426,7 +426,7 @@ impl<'a> DragValue<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for DragValue<'a> {
|
impl Widget for DragValue<'_> {
|
||||||
fn ui(self, ui: &mut Ui) -> Response {
|
fn ui(self, ui: &mut Ui) -> Response {
|
||||||
let Self {
|
let Self {
|
||||||
mut get_set_value,
|
mut get_set_value,
|
||||||
|
|
|
||||||
|
|
@ -372,7 +372,7 @@ impl<'a> Image<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for Image<'a> {
|
impl Widget for Image<'_> {
|
||||||
fn ui(self, ui: &mut Ui) -> Response {
|
fn ui(self, ui: &mut Ui) -> Response {
|
||||||
let tlr = self.load_for_size(ui.ctx(), ui.available_size());
|
let tlr = self.load_for_size(ui.ctx(), ui.available_size());
|
||||||
let original_image_size = tlr.as_ref().ok().and_then(|t| t.size());
|
let original_image_size = tlr.as_ref().ok().and_then(|t| t.size());
|
||||||
|
|
@ -568,7 +568,7 @@ pub enum ImageSource<'a> {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> std::fmt::Debug for ImageSource<'a> {
|
impl std::fmt::Debug for ImageSource<'_> {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
ImageSource::Bytes { uri, .. } | ImageSource::Uri(uri) => uri.as_ref().fmt(f),
|
ImageSource::Bytes { uri, .. } | ImageSource::Uri(uri) => uri.as_ref().fmt(f),
|
||||||
|
|
@ -577,7 +577,7 @@ impl<'a> std::fmt::Debug for ImageSource<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ImageSource<'a> {
|
impl ImageSource<'_> {
|
||||||
/// Size of the texture, if known.
|
/// Size of the texture, if known.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn texture_size(&self) -> Option<Vec2> {
|
pub fn texture_size(&self) -> Option<Vec2> {
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ impl<'a> ImageButton<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for ImageButton<'a> {
|
impl Widget for ImageButton<'_> {
|
||||||
fn ui(self, ui: &mut Ui) -> Response {
|
fn ui(self, ui: &mut Ui) -> Response {
|
||||||
let padding = if self.frame {
|
let padding = if self.frame {
|
||||||
// so we can see that it is a button:
|
// so we can see that it is a button:
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ impl Widget for Label {
|
||||||
// Interactive = the uses asked to sense interaction.
|
// Interactive = the uses asked to sense interaction.
|
||||||
// We DON'T want to have the color respond just because the text is selectable;
|
// We DON'T want to have the color respond just because the text is selectable;
|
||||||
// the cursor is enough to communicate that.
|
// the cursor is enough to communicate that.
|
||||||
let interactive = self.sense.map_or(false, |sense| sense != Sense::hover());
|
let interactive = self.sense.is_some_and(|sense| sense != Sense::hover());
|
||||||
|
|
||||||
let selectable = self.selectable;
|
let selectable = self.selectable;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -643,7 +643,7 @@ impl<'a> Slider<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Slider<'a> {
|
impl Slider<'_> {
|
||||||
/// Just the slider, no text
|
/// Just the slider, no text
|
||||||
fn allocate_slider_space(&self, ui: &mut Ui, thickness: f32) -> Response {
|
fn allocate_slider_space(&self, ui: &mut Ui, thickness: f32) -> Response {
|
||||||
let desired_size = match self.orientation {
|
let desired_size = match self.orientation {
|
||||||
|
|
@ -1015,7 +1015,7 @@ impl<'a> Slider<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for Slider<'a> {
|
impl Widget for Slider<'_> {
|
||||||
fn ui(mut self, ui: &mut Ui) -> Response {
|
fn ui(mut self, ui: &mut Ui) -> Response {
|
||||||
let inner_response = match self.orientation {
|
let inner_response = match self.orientation {
|
||||||
SliderOrientation::Horizontal => ui.horizontal(|ui| self.add_contents(ui)),
|
SliderOrientation::Horizontal => ui.horizontal(|ui| self.add_contents(ui)),
|
||||||
|
|
|
||||||
|
|
@ -88,11 +88,11 @@ pub struct TextEdit<'t> {
|
||||||
background_color: Option<Color32>,
|
background_color: Option<Color32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'t> WidgetWithState for TextEdit<'t> {
|
impl WidgetWithState for TextEdit<'_> {
|
||||||
type State = TextEditState;
|
type State = TextEditState;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'t> TextEdit<'t> {
|
impl TextEdit<'_> {
|
||||||
pub fn load_state(ctx: &Context, id: Id) -> Option<TextEditState> {
|
pub fn load_state(ctx: &Context, id: Id) -> Option<TextEditState> {
|
||||||
TextEditState::load(ctx, id)
|
TextEditState::load(ctx, id)
|
||||||
}
|
}
|
||||||
|
|
@ -394,13 +394,13 @@ impl<'t> TextEdit<'t> {
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
impl<'t> Widget for TextEdit<'t> {
|
impl Widget for TextEdit<'_> {
|
||||||
fn ui(self, ui: &mut Ui) -> Response {
|
fn ui(self, ui: &mut Ui) -> Response {
|
||||||
self.show(ui).response
|
self.show(ui).response
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'t> TextEdit<'t> {
|
impl TextEdit<'_> {
|
||||||
/// Show the [`TextEdit`], returning a rich [`TextEditOutput`].
|
/// Show the [`TextEdit`], returning a rich [`TextEditOutput`].
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,7 @@ impl TextBuffer for String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> TextBuffer for Cow<'a, str> {
|
impl TextBuffer for Cow<'_, str> {
|
||||||
fn is_mutable(&self) -> bool {
|
fn is_mutable(&self) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
@ -259,7 +259,7 @@ impl<'a> TextBuffer for Cow<'a, str> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Immutable view of a `&str`!
|
/// Immutable view of a `&str`!
|
||||||
impl<'a> TextBuffer for &'a str {
|
impl TextBuffer for &str {
|
||||||
fn is_mutable(&self) -> bool {
|
fn is_mutable(&self) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,9 +58,7 @@ impl crate::View for TextEditDemo {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let anything_selected = output
|
let anything_selected = output.cursor_range.is_some_and(|cursor| !cursor.is_empty());
|
||||||
.cursor_range
|
|
||||||
.map_or(false, |cursor| !cursor.is_empty());
|
|
||||||
|
|
||||||
ui.add_enabled(
|
ui.add_enabled(
|
||||||
anything_selected,
|
anything_selected,
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ impl<'a> DatePickerButton<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for DatePickerButton<'a> {
|
impl Widget for DatePickerButton<'_> {
|
||||||
fn ui(self, ui: &mut Ui) -> egui::Response {
|
fn ui(self, ui: &mut Ui) -> egui::Response {
|
||||||
let id = ui.make_persistent_id(self.id_salt);
|
let id = ui.make_persistent_id(self.id_salt);
|
||||||
let mut button_state = ui
|
let mut button_state = ui
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ pub(crate) struct DatePickerPopup<'a> {
|
||||||
pub highlight_weekends: bool,
|
pub highlight_weekends: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DatePickerPopup<'a> {
|
impl DatePickerPopup<'_> {
|
||||||
/// Returns `true` if user pressed `Save` button.
|
/// Returns `true` if user pressed `Save` button.
|
||||||
pub fn draw(&mut self, ui: &mut Ui) -> bool {
|
pub fn draw(&mut self, ui: &mut Ui) -> bool {
|
||||||
let id = ui.make_persistent_id("date_picker");
|
let id = ui.make_persistent_id("date_picker");
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ pub struct Strip<'a, 'b> {
|
||||||
size_index: usize,
|
size_index: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> Strip<'a, 'b> {
|
impl Strip<'_, '_> {
|
||||||
#[cfg_attr(debug_assertions, track_caller)]
|
#[cfg_attr(debug_assertions, track_caller)]
|
||||||
fn next_cell_size(&mut self) -> (CellSize, CellSize) {
|
fn next_cell_size(&mut self) -> (CellSize, CellSize) {
|
||||||
let size = if let Some(size) = self.sizes.get(self.size_index) {
|
let size = if let Some(size) = self.sizes.get(self.size_index) {
|
||||||
|
|
@ -219,7 +219,7 @@ impl<'a, 'b> Strip<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> Drop for Strip<'a, 'b> {
|
impl Drop for Strip<'_, '_> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
while self.size_index < self.sizes.len() {
|
while self.size_index < self.sizes.len() {
|
||||||
self.empty();
|
self.empty();
|
||||||
|
|
|
||||||
|
|
@ -698,7 +698,7 @@ pub struct Table<'a> {
|
||||||
sense: egui::Sense,
|
sense: egui::Sense,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Table<'a> {
|
impl Table<'_> {
|
||||||
/// Access the contained [`egui::Ui`].
|
/// Access the contained [`egui::Ui`].
|
||||||
///
|
///
|
||||||
/// You can use this to e.g. modify the [`egui::Style`] with [`egui::Ui::style_mut`].
|
/// You can use this to e.g. modify the [`egui::Style`] with [`egui::Ui::style_mut`].
|
||||||
|
|
@ -1228,7 +1228,7 @@ impl<'a> TableBody<'a> {
|
||||||
// Capture the hover information for the just created row. This is used in the next render
|
// Capture the hover information for the just created row. This is used in the next render
|
||||||
// to ensure that the entire row is highlighted.
|
// to ensure that the entire row is highlighted.
|
||||||
fn capture_hover_state(&self, response: &Option<Response>, row_index: usize) {
|
fn capture_hover_state(&self, response: &Option<Response>, row_index: usize) {
|
||||||
let is_row_hovered = response.as_ref().map_or(false, |r| r.hovered());
|
let is_row_hovered = response.as_ref().is_some_and(|r| r.hovered());
|
||||||
if is_row_hovered {
|
if is_row_hovered {
|
||||||
self.layout
|
self.layout
|
||||||
.ui
|
.ui
|
||||||
|
|
@ -1237,7 +1237,7 @@ impl<'a> TableBody<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Drop for TableBody<'a> {
|
impl Drop for TableBody<'_> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
self.layout.allocate_rect();
|
self.layout.allocate_rect();
|
||||||
}
|
}
|
||||||
|
|
@ -1264,7 +1264,7 @@ pub struct TableRow<'a, 'b> {
|
||||||
response: &'b mut Option<Response>,
|
response: &'b mut Option<Response>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> TableRow<'a, 'b> {
|
impl TableRow<'_, '_> {
|
||||||
/// Add the contents of a column on this row (i.e. a cell).
|
/// Add the contents of a column on this row (i.e. a cell).
|
||||||
///
|
///
|
||||||
/// Returns the used space (`min_rect`) plus the [`Response`] of the whole cell.
|
/// Returns the used space (`min_rect`) plus the [`Response`] of the whole cell.
|
||||||
|
|
@ -1272,11 +1272,11 @@ impl<'a, 'b> TableRow<'a, 'b> {
|
||||||
pub fn col(&mut self, add_cell_contents: impl FnOnce(&mut Ui)) -> (Rect, Response) {
|
pub fn col(&mut self, add_cell_contents: impl FnOnce(&mut Ui)) -> (Rect, Response) {
|
||||||
let col_index = self.col_index;
|
let col_index = self.col_index;
|
||||||
|
|
||||||
let clip = self.columns.get(col_index).map_or(false, |c| c.clip);
|
let clip = self.columns.get(col_index).is_some_and(|c| c.clip);
|
||||||
let auto_size_this_frame = self
|
let auto_size_this_frame = self
|
||||||
.columns
|
.columns
|
||||||
.get(col_index)
|
.get(col_index)
|
||||||
.map_or(false, |c| c.auto_size_this_frame);
|
.is_some_and(|c| c.auto_size_this_frame);
|
||||||
|
|
||||||
let width = if let Some(width) = self.widths.get(col_index) {
|
let width = if let Some(width) = self.widths.get(col_index) {
|
||||||
self.col_index += 1;
|
self.col_index += 1;
|
||||||
|
|
@ -1355,7 +1355,7 @@ impl<'a, 'b> TableRow<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> Drop for TableRow<'a, 'b> {
|
impl Drop for TableRow<'_, '_> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
self.layout.end_line();
|
self.layout.end_line();
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ pub(crate) enum AppKind<'a, State> {
|
||||||
Eframe(AppKindEframe<'a, State>),
|
Eframe(AppKindEframe<'a, State>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, State> AppKind<'a, State> {
|
impl<State> AppKind<'_, State> {
|
||||||
pub fn run(
|
pub fn run(
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &egui::Context,
|
ctx: &egui::Context,
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ pub struct Harness<'a, State = ()> {
|
||||||
step_dt: f32,
|
step_dt: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, State> Debug for Harness<'a, State> {
|
impl<State> Debug for Harness<'_, State> {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
self.kittest.fmt(f)
|
self.kittest.fmt(f)
|
||||||
}
|
}
|
||||||
|
|
@ -461,7 +461,7 @@ impl<'a> Harness<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'t, 'n, 'h, State> Queryable<'t, 'n> for Harness<'h, State>
|
impl<'t, 'n, State> Queryable<'t, 'n> for Harness<'_, State>
|
||||||
where
|
where
|
||||||
'n: 't,
|
'n: 't,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ mod rw_lock_impl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> Deref for RwLockReadGuard<'a, T> {
|
impl<T> Deref for RwLockReadGuard<'_, T> {
|
||||||
type Target = T;
|
type Target = T;
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
|
|
@ -198,7 +198,7 @@ mod rw_lock_impl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> Drop for RwLockReadGuard<'a, T> {
|
impl<T> Drop for RwLockReadGuard<'_, T> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let tid = std::thread::current().id();
|
let tid = std::thread::current().id();
|
||||||
self.holders.lock().remove(&tid);
|
self.holders.lock().remove(&tid);
|
||||||
|
|
@ -229,7 +229,7 @@ mod rw_lock_impl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> Deref for RwLockWriteGuard<'a, T> {
|
impl<T> Deref for RwLockWriteGuard<'_, T> {
|
||||||
type Target = T;
|
type Target = T;
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
|
|
@ -237,13 +237,13 @@ mod rw_lock_impl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> DerefMut for RwLockWriteGuard<'a, T> {
|
impl<T> DerefMut for RwLockWriteGuard<'_, T> {
|
||||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||||
self.guard.as_mut().unwrap()
|
self.guard.as_mut().unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> Drop for RwLockWriteGuard<'a, T> {
|
impl<T> Drop for RwLockWriteGuard<'_, T> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let tid = std::thread::current().id();
|
let tid = std::thread::current().id();
|
||||||
self.holders.lock().remove(&tid);
|
self.holders.lock().remove(&tid);
|
||||||
|
|
|
||||||
|
|
@ -993,22 +993,22 @@ impl RowBreakCandidates {
|
||||||
punctuation,
|
punctuation,
|
||||||
any,
|
any,
|
||||||
} = self;
|
} = self;
|
||||||
if space.map_or(false, |s| s < index) {
|
if space.is_some_and(|s| s < index) {
|
||||||
*space = None;
|
*space = None;
|
||||||
}
|
}
|
||||||
if cjk.map_or(false, |s| s < index) {
|
if cjk.is_some_and(|s| s < index) {
|
||||||
*cjk = None;
|
*cjk = None;
|
||||||
}
|
}
|
||||||
if pre_cjk.map_or(false, |s| s < index) {
|
if pre_cjk.is_some_and(|s| s < index) {
|
||||||
*pre_cjk = None;
|
*pre_cjk = None;
|
||||||
}
|
}
|
||||||
if dash.map_or(false, |s| s < index) {
|
if dash.is_some_and(|s| s < index) {
|
||||||
*dash = None;
|
*dash = None;
|
||||||
}
|
}
|
||||||
if punctuation.map_or(false, |s| s < index) {
|
if punctuation.is_some_and(|s| s < index) {
|
||||||
*punctuation = None;
|
*punctuation = None;
|
||||||
}
|
}
|
||||||
if any.map_or(false, |s| s < index) {
|
if any.is_some_and(|s| s < index) {
|
||||||
*any = None;
|
*any = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue