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);
|
||||
}
|
||||
|
||||
/// 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.
|
||||
#[cfg(feature = "ron")]
|
||||
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> {
|
||||
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(
|
||||
&mut self,
|
||||
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> {
|
||||
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) {
|
||||
profiling::function_scope!();
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ impl WgpuSetup {
|
|||
#[cfg(target_arch = "wasm32")]
|
||||
if backends.contains(wgpu::Backends::BROWSER_WEBGPU) {
|
||||
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 {
|
||||
log::info!(
|
||||
"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>,
|
||||
}
|
||||
|
||||
impl<'ui, HeaderRet> HeaderResponse<'ui, HeaderRet> {
|
||||
impl<HeaderRet> HeaderResponse<'_, HeaderRet> {
|
||||
pub fn is_open(&self) -> bool {
|
||||
self.state.is_open()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1184,7 +1184,7 @@ impl Prepared {
|
|||
&& ui.input(|i| {
|
||||
i.pointer
|
||||
.latest_pos()
|
||||
.map_or(false, |p| handle_rect.contains(p))
|
||||
.is_some_and(|p| handle_rect.contains(p))
|
||||
});
|
||||
let visuals = ui.visuals();
|
||||
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 `Some(InnerResponse { inner: None })` if the window is collapsed.
|
||||
#[inline]
|
||||
|
|
|
|||
|
|
@ -211,14 +211,14 @@ impl ContextImpl {
|
|||
fn requested_immediate_repaint_prev_pass(&self, viewport_id: &ViewportId) -> bool {
|
||||
self.viewports
|
||||
.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]
|
||||
fn has_requested_repaint(&self, viewport_id: &ViewportId) -> bool {
|
||||
self.viewports.get(viewport_id).map_or(false, |v| {
|
||||
0 < v.repaint.outstanding || v.repaint.repaint_delay < Duration::MAX
|
||||
})
|
||||
self.viewports
|
||||
.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"]
|
||||
pub fn widget_contains_pointer(&self, id: Id) -> bool {
|
||||
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.
|
||||
|
|
@ -2632,7 +2632,7 @@ impl Context {
|
|||
pub fn is_context_menu_open(&self) -> bool {
|
||||
self.data(|d| {
|
||||
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 {
|
||||
let mut s = String::new();
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ impl<'de> serde::Deserialize<'de> for UserData {
|
|||
{
|
||||
struct UserDataVisitor;
|
||||
|
||||
impl<'de> serde::de::Visitor<'de> for UserDataVisitor {
|
||||
impl serde::de::Visitor<'_> for UserDataVisitor {
|
||||
type Value = UserData;
|
||||
|
||||
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 {
|
||||
ctx.data(|data| {
|
||||
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.has_moved_too_much_for_a_click
|
||||
&& 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
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -679,7 +679,7 @@ impl MenuState {
|
|||
|| self
|
||||
.sub_menu
|
||||
.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 {
|
||||
|
|
|
|||
|
|
@ -618,7 +618,7 @@ impl Response {
|
|||
let any_open_popups = self.ctx.prev_pass_state(|fs| {
|
||||
fs.layers
|
||||
.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 {
|
||||
// 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
|
||||
.chars()
|
||||
.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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -229,13 +229,13 @@ impl UiStack {
|
|||
/// Is this [`crate::Ui`] a panel?
|
||||
#[inline]
|
||||
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`]?
|
||||
#[inline]
|
||||
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()`]?
|
||||
|
|
@ -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 {
|
||||
let Checkbox {
|
||||
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 {
|
||||
let Self {
|
||||
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 {
|
||||
let tlr = self.load_for_size(ui.ctx(), ui.available_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 {
|
||||
match self {
|
||||
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.
|
||||
#[inline]
|
||||
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 {
|
||||
let padding = if self.frame {
|
||||
// so we can see that it is a button:
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ impl Widget for Label {
|
|||
// Interactive = the uses asked to sense interaction.
|
||||
// We DON'T want to have the color respond just because the text is selectable;
|
||||
// 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;
|
||||
|
||||
|
|
|
|||
|
|
@ -643,7 +643,7 @@ impl<'a> Slider<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Slider<'a> {
|
||||
impl Slider<'_> {
|
||||
/// Just the slider, no text
|
||||
fn allocate_slider_space(&self, ui: &mut Ui, thickness: f32) -> Response {
|
||||
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 {
|
||||
let inner_response = match self.orientation {
|
||||
SliderOrientation::Horizontal => ui.horizontal(|ui| self.add_contents(ui)),
|
||||
|
|
|
|||
|
|
@ -88,11 +88,11 @@ pub struct TextEdit<'t> {
|
|||
background_color: Option<Color32>,
|
||||
}
|
||||
|
||||
impl<'t> WidgetWithState for TextEdit<'t> {
|
||||
impl WidgetWithState for TextEdit<'_> {
|
||||
type State = TextEditState;
|
||||
}
|
||||
|
||||
impl<'t> TextEdit<'t> {
|
||||
impl TextEdit<'_> {
|
||||
pub fn load_state(ctx: &Context, id: Id) -> Option<TextEditState> {
|
||||
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 {
|
||||
self.show(ui).response
|
||||
}
|
||||
}
|
||||
|
||||
impl<'t> TextEdit<'t> {
|
||||
impl TextEdit<'_> {
|
||||
/// 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 {
|
||||
true
|
||||
}
|
||||
|
|
@ -259,7 +259,7 @@ impl<'a> TextBuffer for Cow<'a, str> {
|
|||
}
|
||||
|
||||
/// Immutable view of a `&str`!
|
||||
impl<'a> TextBuffer for &'a str {
|
||||
impl TextBuffer for &str {
|
||||
fn is_mutable(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,9 +58,7 @@ impl crate::View for TextEditDemo {
|
|||
}
|
||||
});
|
||||
|
||||
let anything_selected = output
|
||||
.cursor_range
|
||||
.map_or(false, |cursor| !cursor.is_empty());
|
||||
let anything_selected = output.cursor_range.is_some_and(|cursor| !cursor.is_empty());
|
||||
|
||||
ui.add_enabled(
|
||||
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 {
|
||||
let id = ui.make_persistent_id(self.id_salt);
|
||||
let mut button_state = ui
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ pub(crate) struct DatePickerPopup<'a> {
|
|||
pub highlight_weekends: bool,
|
||||
}
|
||||
|
||||
impl<'a> DatePickerPopup<'a> {
|
||||
impl DatePickerPopup<'_> {
|
||||
/// Returns `true` if user pressed `Save` button.
|
||||
pub fn draw(&mut self, ui: &mut Ui) -> bool {
|
||||
let id = ui.make_persistent_id("date_picker");
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ pub struct Strip<'a, 'b> {
|
|||
size_index: usize,
|
||||
}
|
||||
|
||||
impl<'a, 'b> Strip<'a, 'b> {
|
||||
impl Strip<'_, '_> {
|
||||
#[cfg_attr(debug_assertions, track_caller)]
|
||||
fn next_cell_size(&mut self) -> (CellSize, CellSize) {
|
||||
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) {
|
||||
while self.size_index < self.sizes.len() {
|
||||
self.empty();
|
||||
|
|
|
|||
|
|
@ -698,7 +698,7 @@ pub struct Table<'a> {
|
|||
sense: egui::Sense,
|
||||
}
|
||||
|
||||
impl<'a> Table<'a> {
|
||||
impl Table<'_> {
|
||||
/// Access the contained [`egui::Ui`].
|
||||
///
|
||||
/// 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
|
||||
// to ensure that the entire row is highlighted.
|
||||
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 {
|
||||
self.layout
|
||||
.ui
|
||||
|
|
@ -1237,7 +1237,7 @@ impl<'a> TableBody<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Drop for TableBody<'a> {
|
||||
impl Drop for TableBody<'_> {
|
||||
fn drop(&mut self) {
|
||||
self.layout.allocate_rect();
|
||||
}
|
||||
|
|
@ -1264,7 +1264,7 @@ pub struct TableRow<'a, 'b> {
|
|||
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).
|
||||
///
|
||||
/// 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) {
|
||||
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
|
||||
.columns
|
||||
.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) {
|
||||
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]
|
||||
fn drop(&mut self) {
|
||||
self.layout.end_line();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub(crate) enum AppKind<'a, State> {
|
|||
Eframe(AppKindEframe<'a, State>),
|
||||
}
|
||||
|
||||
impl<'a, State> AppKind<'a, State> {
|
||||
impl<State> AppKind<'_, State> {
|
||||
pub fn run(
|
||||
&mut self,
|
||||
ctx: &egui::Context,
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ pub struct Harness<'a, State = ()> {
|
|||
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 {
|
||||
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
|
||||
'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;
|
||||
|
||||
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) {
|
||||
let tid = std::thread::current().id();
|
||||
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;
|
||||
|
||||
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 {
|
||||
self.guard.as_mut().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T> Drop for RwLockWriteGuard<'a, T> {
|
||||
impl<T> Drop for RwLockWriteGuard<'_, T> {
|
||||
fn drop(&mut self) {
|
||||
let tid = std::thread::current().id();
|
||||
self.holders.lock().remove(&tid);
|
||||
|
|
|
|||
|
|
@ -993,22 +993,22 @@ impl RowBreakCandidates {
|
|||
punctuation,
|
||||
any,
|
||||
} = self;
|
||||
if space.map_or(false, |s| s < index) {
|
||||
if space.is_some_and(|s| s < index) {
|
||||
*space = None;
|
||||
}
|
||||
if cjk.map_or(false, |s| s < index) {
|
||||
if cjk.is_some_and(|s| s < index) {
|
||||
*cjk = None;
|
||||
}
|
||||
if pre_cjk.map_or(false, |s| s < index) {
|
||||
if pre_cjk.is_some_and(|s| s < index) {
|
||||
*pre_cjk = None;
|
||||
}
|
||||
if dash.map_or(false, |s| s < index) {
|
||||
if dash.is_some_and(|s| s < index) {
|
||||
*dash = None;
|
||||
}
|
||||
if punctuation.map_or(false, |s| s < index) {
|
||||
if punctuation.is_some_and(|s| s < index) {
|
||||
*punctuation = None;
|
||||
}
|
||||
if any.map_or(false, |s| s < index) {
|
||||
if any.is_some_and(|s| s < index) {
|
||||
*any = None;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue