From nobody Tue Nov 26 10:41:41 2024 Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E54071DF964 for ; Sat, 19 Oct 2024 08:41:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327289; cv=none; b=f8ynry5KnTRV9lrDh9R9OjQo7RR8uHqYa+KjYFg+GPYqTTONnr6KOhSZHEryDjIT2bYQ1ERlEZGByAnYR2QX0Wpaxi8/wnGqqXIf2IRDBTvXLD0DLy63u2CmMLMxUIBFHNGnkssRzOCYbv656giYOvO8n6/SUikklzqO5aK0fQI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729327289; c=relaxed/simple; bh=xP6psgp3z1V+o06XpNvgK8OnqzkvRz5weBneZzXJmg8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=N2Acb6sX6p65UHxAcewyJIBTY1gPi7YHJHKkyKlAZ5C6s6AvRRiSvhwcVLSfJdqYE1EdpIah3h4NrrAA4V1LuCOu05cTJ/vgLpBhzE4vE6F+dCWQHqTkyJS0Wpyo7YBwxsQAi7Xa5MNr7W7fNTbtf2QSfU02nJUNmY+MlCfSfms= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de; spf=pass smtp.mailfrom=wiredspace.de; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b=PiPe7bTK; arc=none smtp.client-ip=91.218.175.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b="PiPe7bTK" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wiredspace.de; s=key1; t=1729327283; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MvE6s92/wC5cLsJQ+TrZaR3ILrSklzHNRSWsRlnX0mQ=; b=PiPe7bTKQQ/os25ThxXPVymZKUjOYfTSoE/TAMcRdn1qGhVjuC1ZLz48w1tOzcg73HFMei GPX1yoAiP1LuNoj2R/jorwat42x1mK9KY+WDvvkqvTP5zzRdmYG/DBH8YvD0nXy/pLnVVX DRdHGNRMI5CGFEioyInfJ8QuYMRJkYA= From: =?UTF-8?q?Thomas=20B=C3=B6hler?= To: Miguel Ojeda , Alex Gaynor , Jocelyn Falempe Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , rust-for-linux@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Thomas=20B=C3=B6hler?= Subject: [PATCH v2 3/7] drm/panic: prefer eliding lifetimes Date: Sat, 19 Oct 2024 10:22:48 +0200 Message-ID: <20241019084048.22336-4-witcher@wiredspace.de> In-Reply-To: <20241019084048.22336-1-witcher@wiredspace.de> References: <20241019084048.22336-1-witcher@wiredspace.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Eliding lifetimes when possible instead of specifying them directly is both shorter and easier to read. Clippy notes this in the `needless_lifetimes` lint: error: the following explicit lifetimes could be elided: 'b --> drivers/gpu/drm/drm_panic_qr.rs:479:16 | 479 | fn new<'a, 'b>(segments: &[&Segment<'b>], data: &'a mut [u8])= -> Option> { | ^^ ^^ | =3D help: for further information visit https://rust-lang.github.io= /rust-clippy/master/index.html#needless_lifetimes =3D note: `-D clippy::needless-lifetimes` implied by `-D warnings` =3D help: to override `-D warnings` add `#[allow(clippy::needless_l= ifetimes)]` help: elide the lifetimes | 479 - fn new<'a, 'b>(segments: &[&Segment<'b>], data: &'a mut [u8])= -> Option> { 479 + fn new<'a>(segments: &[&Segment<'_>], data: &'a mut [u8]) -> = Option> { | Remove the explicit lifetime annotation in favour of an elided lifetime. Fixes: cb5164ac43d0 ("drm/panic: Add a QR code panic screen") Reported-by: Miguel Ojeda Link: https://github.com/Rust-for-Linux/linux/issues/1123 Signed-off-by: Thomas B=C3=B6hler Reviewed-by: Jocelyn Falempe --- drivers/gpu/drm/drm_panic_qr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_panic_qr.rs b/drivers/gpu/drm/drm_panic_qr= .rs index 7adfaa3d6222..767a8eb0acec 100644 --- a/drivers/gpu/drm/drm_panic_qr.rs +++ b/drivers/gpu/drm/drm_panic_qr.rs @@ -476,7 +476,7 @@ struct EncodedMsg<'a> { /// Data to be put in the QR code, with correct segment encoding, padding,= and /// Error Code Correction. impl EncodedMsg<'_> { - fn new<'a, 'b>(segments: &[&Segment<'b>], data: &'a mut [u8]) -> Optio= n> { + fn new<'a>(segments: &[&Segment<'_>], data: &'a mut [u8]) -> Option> { let version =3D Version::from_segments(segments)?; let ec_size =3D version.ec_size(); let g1_blocks =3D version.g1_blocks(); --=20 2.46.2