Skip to content

Commit f14a397

Browse files
committed
WIP Enable clippy::same_name_method lint
It is confusing and error prone to have a method on a type and a trait implemented by that type with the same name. This is particularly bad for something like `<Window as SpaceElement>::bbox`, which actually calls `Window::bbox_with_popups`. Which is different from `Window::box`. But these three functions have the same type signature. It seems good to disallow this lint in general, but it can be allowed where the methods do the same thing.
1 parent df79eeb commit f14a397

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

src/backend/renderer/gles/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2460,7 +2460,7 @@ impl<'frame> GlesFrame<'frame> {
24602460
/// Optionally allows a custom texture program and matching additional uniforms to be passed in.
24612461
#[instrument(level = "trace", skip(self), parent = &self.span)]
24622462
#[profiling::function]
2463-
#[allow(clippy::too_many_arguments)]
2463+
#[allow(clippy::same_name_method, clippy::too_many_arguments)]
24642464
pub fn render_texture_from_to(
24652465
&mut self,
24662466
texture: &GlesTexture,

src/desktop/wayland/layer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ impl LayerSurface {
530530

531531
/// Returns the underlying [`WlSurface`]
532532
#[inline]
533+
#[allow(clippy::same_name_method)]
533534
pub fn wl_surface(&self) -> &WlSurface {
534535
self.0.surface.wl_surface()
535536
}
@@ -721,6 +722,6 @@ impl LayerSurface {
721722
impl WaylandFocus for LayerSurface {
722723
#[inline]
723724
fn wl_surface(&self) -> Option<Cow<'_, wl_surface::WlSurface>> {
724-
Some(Cow::Borrowed(self.0.surface.wl_surface()))
725+
Some(Cow::Borrowed(self.wl_surface()))
725726
}
726727
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
2-
#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms)]
2+
#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms, clippy::same_name_method)]
33
// Allow acronyms like EGL
44
#![allow(clippy::upper_case_acronyms)]
55

src/wayland/drm_syncobj/sync_point.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ impl DrmSyncPoint {
7979
}
8080

8181
/// Wait for sync point.
82+
#[allow(clippy::same_name_method)]
8283
pub fn wait(&self, timeout_nsec: i64) -> io::Result<()> {
8384
self.timeline.0.device.syncobj_timeline_wait(
8485
&[self.timeline.0.syncobj],

0 commit comments

Comments
 (0)