Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1722876lqz; Mon, 1 Apr 2024 15:29:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXKTr5PUEhGORwaHok5UUryqDItvgA7Sgo1Re8zTxxS6nz3kPBSsMU7rcQKWqsHL8Sn6RruC8Hz9gbegH0HqBOLq+QDRLix0nLs9yOXdw== X-Google-Smtp-Source: AGHT+IFH0KozcNcySE2U1nZhWC/f+5OhSp2DVdirte1RoWYbpbX+8gQ5DxyErIWB3VrCcsUQqyW6 X-Received: by 2002:a17:902:f705:b0:1e2:5e32:4444 with SMTP id h5-20020a170902f70500b001e25e324444mr2049364plo.10.1712010592541; Mon, 01 Apr 2024 15:29:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712010592; cv=pass; d=google.com; s=arc-20160816; b=m/q039GV4I1g9rz/w7pFmzFh0PM/8H4TSJnfz8ZqjM4gzsrWQL6VxM10Mu+m6KYS9C ABtxk/KNAueMHVkco3Kd5ti4IlQBZDjzM9qrZxyHi9mKB2AHHdW+xhYWDL4OQ7F0wSN9 uSks/ZLTDqGAq1vQvNjKABxKR7pJK7cahj5vBrDQywwRIeWA4lezrJF8vpfSu0gTnxKT 5doQRz/t6C5peVIzZ+3P1WARXRKeur+DXmEZ0OmfL42eZlomRAffxODNBvcDIoYUpVZv d3SAefO5VfV789syHIWhMNV3/TTQU2olZY5AtTBc10lpOJ89ewd/Cli2pZetaa+NpLiw /WPA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature; bh=fun6t9xjAHzzOFt7K8uuNDThfEvVvoMsgmIVU5DYRmw=; fh=uS8WtiXJR7PtLTzEK+A2E9iyffDo66rWn0jm2DLpy1c=; b=m5IJKU58fY+HFgxmtt5tJrXa5WP/5e9t9j2iKOiSklBXjoelhSwII7OhO3XXcgTiPw blhGJm6IuNWlS9ZduCLFlKjvCpOyaewYBfBWdEbpcOTrlQo2CFvRnz+vC1DQO9Iqp1dw 5hcj4NPfPjeUzzFzzjnrTa34l+MjFNCAKqvUoJ6PV+ts5FzhtsDy+7b/9avsC4bNCpZr Hv06+oOZvMLnF1505LCA4mixM1gXlANgCTFj0D0lZLMXifp9HdHCxGEeX41AHeOxXk9c HNDvY9MH5/ju3dYD1eUBLxmz0G25Duw3Cmj2CFVFJRX5lUT+zueYhgf5WWrywWyUQE52 QGYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ihGlFXol; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-127133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127133-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id z7-20020a170902d54700b001e25d9dd74csi1557597plf.416.2024.04.01.15.29.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 15:29:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ihGlFXol; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-127133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127133-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6BBC1B22173 for ; Mon, 1 Apr 2024 22:27:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B0135674B; Mon, 1 Apr 2024 22:27:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ihGlFXol" Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF8C156450; Mon, 1 Apr 2024 22:27:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712010454; cv=none; b=R7HqRTBgnwzo3VtV9RqvhPXCljBfyZLMGdS7reMj9+0tewwh+zEYdetGukxbSJonDx8F71qyx0Y+qUIMjbHc2oY3xXYLOCXEQdg/m/Sc6q9HQkgXR2I9rruZFfPCygB2ZsJps9Y5lUx01cH/vpTenVytToJ/nJP5Dju32HSr/4c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712010454; c=relaxed/simple; bh=qd7DeB+UKGgiHHgmFI7NeiZR0UBVUqW1EUS3QsOSWAw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FF0FiMV9LBhv/Ys4c77BUa75Wve9Qbz+lIPuQKafnVOhUKJEpBCQnRIj4qhUp6twOHEFjrhroUIJ3vr9rwfBXiJfIhudkKQJhiL9wScFSJwi4cXAcXerQLSeKdOTnwZFSTfm2Vvw8L6QkyQXSXE8LkC1PZ8D5janYK08Z7Llfoo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ihGlFXol; arc=none smtp.client-ip=209.85.219.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-dcd9e34430cso4654030276.1; Mon, 01 Apr 2024 15:27:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712010452; x=1712615252; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=fun6t9xjAHzzOFt7K8uuNDThfEvVvoMsgmIVU5DYRmw=; b=ihGlFXolIcaMgomowbbckWYe7cDig5ECNMPwjtEPl+MbqFw/Z67doXIVwUDyU/Jcfe TTsaANEZmuxRbhpBgOeSh0hraKGaZCJGzuTSD49kOflEFWjchOv41N+S+pA1zqiQdw9J RHQY5zDT/wr4Kn9WC0fyoXZfBlXpDkGcwDjH+kbRGJjPmpCl92Dkf15DAruMrQSvRvLa hexImL3b5DzCprCAIyZ9dwCdAvcuM8+GLMpEgBkPQRwgpa7ZnwJUdrCkO3A32en+nU59 zDQ2m8t/h/t51lByv+vMpw1nhGxw86JVbFoxsdsZtkG5XVUQAXLf+7jbRNgR4BB7HDjs M0wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712010452; x=1712615252; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fun6t9xjAHzzOFt7K8uuNDThfEvVvoMsgmIVU5DYRmw=; b=k3UIyiibU57Q5/bnL6gkwdl14dFF1SMbSYobOr8XE3H8ctvV0zeSNBMT2aPCA/iSnO QkD4DCrka4O13L3q2S7RjSnb05wsbO6tN+XoeT/gMQEiXQpIYXlHlQ8JhFIN0qnkSQrv WghSzxOvEH3A14Oy6RlIP92Xx3VI/H1V8y2/39Mwq/Y7Z2pwrX0NOR9Dc3qhKZDJ3yMA lnzNLPfUIEUngtaLzVXdg/DALKsaqCXfbg4yDmy+jhVMjSVi5JO6lhzXLqQB1j/r82Kz p1YSqOCpJ3jmajPLsv2w7Gc99HNHKxwcxO8SU3UiBA0T3Ty7TF5k977PS5CHJlYzKtS6 IKeg== X-Forwarded-Encrypted: i=1; AJvYcCVObKfxfmwebkCM3HtnU7pOMvqJwakrZAzdMgjdGWIZl57NXoojND16/PFnzRm++tL/5B3iQyKzZQ30aYdLi47NM1Kr8coBvKEAaEGd8xsGtFMUiBgf/+JwidNtM2HePNIlgv50Gv8WsMrcc4Y= X-Gm-Message-State: AOJu0YyRDn4I+OpNpgfxZmwSdQxPFAavDXJ1WOVe8eG1ez3CD6cUroum /kmwAle4pSjSjsNN6CAPxrZga+hHAIixWUckL5c7sHqvw21BOUAZ X-Received: by 2002:a25:fb05:0:b0:dc6:ff32:aaea with SMTP id j5-20020a25fb05000000b00dc6ff32aaeamr8588124ybe.24.1712010451861; Mon, 01 Apr 2024 15:27:31 -0700 (PDT) Received: from fauth1-smtp.messagingengine.com (fauth1-smtp.messagingengine.com. [103.168.172.200]) by smtp.gmail.com with ESMTPSA id jz9-20020a0562140e6900b00698f825b08csm3118580qvb.70.2024.04.01.15.27.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 15:27:31 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfauth.nyi.internal (Postfix) with ESMTP id 75EFF1200066; Mon, 1 Apr 2024 18:27:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 01 Apr 2024 18:27:30 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudefuddgtdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpefftdeihfeigedtvdeuueffieetvedtgeejuefhhffgudfgfeeggfeftdei geehvdenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhh phgvrhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunh drfhgvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgv X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 1 Apr 2024 18:27:29 -0400 (EDT) Date: Mon, 1 Apr 2024 15:26:37 -0700 From: Boqun Feng To: Miguel Ojeda Cc: Wedson Almeida Filho , Alex Gaynor , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev Subject: Re: [PATCH 1/3] rust: sync: implement `Default` for `LockClassKey` Message-ID: References: <20240401212303.537355-1-ojeda@kernel.org> <20240401212303.537355-2-ojeda@kernel.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240401212303.537355-2-ojeda@kernel.org> On Mon, Apr 01, 2024 at 11:23:01PM +0200, Miguel Ojeda wrote: > In the upcoming Rust 1.78.0, Clippy suggests to implement `Default` even > when `new()` is `const`, since `Default::default()` may call `const` > functions even if it is not `const` itself [1]: > > error: you should consider adding a `Default` implementation for `LockClassKey` > --> rust/kernel/sync.rs:31:5 > | > 31 | / pub const fn new() -> Self { > 32 | | Self(Opaque::uninit()) > 33 | | } > | |_____^ > > Thus implement it. > > Link: https://github.com/rust-lang/rust-clippy/pull/10903 [1] > Signed-off-by: Miguel Ojeda Reviewed-by: Boqun Feng Regards, Boqun > --- > rust/kernel/sync.rs | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/rust/kernel/sync.rs b/rust/kernel/sync.rs > index c983f63fd56e..0ab20975a3b5 100644 > --- a/rust/kernel/sync.rs > +++ b/rust/kernel/sync.rs > @@ -37,6 +37,12 @@ pub(crate) fn as_ptr(&self) -> *mut bindings::lock_class_key { > } > } > > +impl Default for LockClassKey { > + fn default() -> Self { > + Self::new() > + } > +} > + > /// Defines a new static lock class and returns a pointer to it. > #[doc(hidden)] > #[macro_export] > -- > 2.44.0 >