Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5629250rwb; Mon, 14 Nov 2022 07:21:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf519tBjn5pqiplyRpVOD7/HA+ROKpjRfRFZz4KI1BOjOO+YViXqTDl0yucN1GG8eTOTka+u X-Received: by 2002:a62:7955:0:b0:56b:e64c:5c7e with SMTP id u82-20020a627955000000b0056be64c5c7emr14185102pfc.18.1668439314082; Mon, 14 Nov 2022 07:21:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668439314; cv=pass; d=google.com; s=arc-20160816; b=XHLeeiZxdztbkggx5IF+t2ocn1Ii9N6qMeoWq2KyXKHmTkb8/GqWHHK4oCoMr20jsH US6vzp28OQpWgtWcFwP5zyQpkfINX6h8XTBVHP/KRKw6QloYtnAQfddnwxzh6sIrN0G1 7U+xLTGo5LVpYCio2m14xS3isaaWpGzVqVwMl9ce1j6vvXqobA5CSF12bZPaGG26MItv vsidC4Yz3oodMY1SBxYZhcNN23xLgII+8SojsLaZRUWWbgshVcOLJ6HjJs3tOokhQEJ5 GgXO5Uuu9oVJfu+o0/zGNyo1yxD4i8T+QueGsx/vv9Qp8QUg5OeovHkOslgWkRO1Bize /RHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=nwLvjN7UqFR4+ktK51aUJTCFdTr2wbHU1dP6fXqAVdE=; b=rLRhW7hNNdaXJSLZCS6+Ubpj/COhQolUboIO39h99Bsve+sWvZswCDbsgxWxht4eBK disheKDRPii9X6oM1itvI0rQyoJWPlHELPUQaW5yc3rBWKKpiOSneQ4ev4eSNUQXERCp U7JFmXeoQkJIsPArsvRN2reylQvXq0pdkq1kI8ayPHXgubJ8WxzsBg5Z3lplDBITDvY/ 4iNotzKQpait/UL3LBdspl1gwMxOXuYH401bGakJjYTzAL5xmjAIap4xriK0X+jBhoGe ZbuIPUUT2HkYFhp+QaHB2DIrGuqO1ZGiQzDF9wwhYA95p3G9X9hq2fjUTkS4U5/sNxbv Ti2Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@garyguo.net header.s=selector1 header.b=FUyWpup5; arc=pass (i=1 spf=pass spfdomain=garyguo.net dkim=pass dkdomain=garyguo.net dmarc=pass fromdomain=garyguo.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k1-20020a170902d58100b0018694b85992si7022449plh.389.2022.11.14.07.21.41; Mon, 14 Nov 2022 07:21:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@garyguo.net header.s=selector1 header.b=FUyWpup5; arc=pass (i=1 spf=pass spfdomain=garyguo.net dkim=pass dkdomain=garyguo.net dmarc=pass fromdomain=garyguo.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236431AbiKNO7W (ORCPT + 88 others); Mon, 14 Nov 2022 09:59:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236124AbiKNO6u (ORCPT ); Mon, 14 Nov 2022 09:58:50 -0500 Received: from GBR01-CWL-obe.outbound.protection.outlook.com (mail-cwlgbr01on2124.outbound.protection.outlook.com [40.107.11.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC67F1DA67; Mon, 14 Nov 2022 06:58:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VBWx1D/j3t1TCpxo2wgFpDAO7a1cvIFwAmOA4S+v1VtFJ31mnOagwygzuBy+SjcoOv+BI8VxcjKDgWmmhL6CSxwTHO6mat40Y9bz3VTrH7ZWS0SETm+zoFRMtuWiygkOvz334a9JkAcTXgofDIZaII9jmG5qnMcfzgfOk/HZOL8JNr0quvfuqwrcOOkJfB7cSmf6nqhS8QOXkDaMOxXAVSQxhHCvdSaUq99uesgCxyYAqPfZ/llLiLDu5Rf+rnDLs1sJ8/oF8seXTx3R2p/JPCFcwhXdodMRxq+mXOuZuS7geWOGGcf/0n+t845s083uMpIc6JXZlPOq8r8GLvJOWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nwLvjN7UqFR4+ktK51aUJTCFdTr2wbHU1dP6fXqAVdE=; b=S4wKE4S4SeV1N+iBxbJWz/7DhQKACnrHDhHticPYk9JPYJRrUC5IFCngnbL+oy6DWMZvm1yL3A3bC1xQRK/ZIyVr+NiMwC6+5qEbr4QtUz6puVPC657zhvKi6QUPr5NYNqxwN1P1VGUTVajTombYDaX9/SbumqZJP3bjfB6FzK6VhE40SGndvWu/yK2OOJ6oYMH+CwZqZ3wKnuYDeq/bAriA/xlaDbI9cHC9V5JM6mien9cjxJUeMG9j5xYd8g2/xkrvdLZoJpcGf2OuYAfih8rrSWx5PM6HWjtRRaqh0iu7QyfLg+AZwMI5qKcHg0iw3UALGPGxV/VpcligJ5RiJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=garyguo.net; dmarc=pass action=none header.from=garyguo.net; dkim=pass header.d=garyguo.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garyguo.net; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nwLvjN7UqFR4+ktK51aUJTCFdTr2wbHU1dP6fXqAVdE=; b=FUyWpup5knN7vNQhe72Seot8AGJNuAzRmDWLwksUR6u/yfHPxWtL4H/pjCGgQqH6LqJY9XUQHD0RlDxAcmj+PLNdahrrQa6RQXEVZw2ZcqUnwKuGCdil3HR/GIf2EohVEirwk8fBTZ5076pn3GfZBCnOhl1JUu+YSoQoL7qOj0Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=garyguo.net; Received: from LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:253::10) by LO3P265MB1915.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:b2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.17; Mon, 14 Nov 2022 14:58:46 +0000 Received: from LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM ([fe80::6c07:e2da:3210:3fd7]) by LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM ([fe80::6c07:e2da:3210:3fd7%6]) with mapi id 15.20.5813.017; Mon, 14 Nov 2022 14:58:46 +0000 Date: Mon, 14 Nov 2022 14:58:45 +0000 From: Gary Guo To: Miguel Ojeda Cc: Wedson Almeida Filho , Alex Gaynor , Boqun Feng , =?UTF-8?B?QmrDtnJu?= Roy Baron , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev Subject: Re: [PATCH v1 22/28] rust: str: add `fmt!` macro Message-ID: <20221114145845.519fe889@GaryWorkstation> In-Reply-To: <20221110164152.26136-23-ojeda@kernel.org> References: <20221110164152.26136-1-ojeda@kernel.org> <20221110164152.26136-23-ojeda@kernel.org> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0391.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::19) To LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:253::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LO2P265MB5183:EE_|LO3P265MB1915:EE_ X-MS-Office365-Filtering-Correlation-Id: ab11f999-36db-43de-d465-08dac650bb42 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G1XA43U3x3I9X6wxs1WcKeGiHlEYp8sc4FldRidoxl5KSLsZkwFhvjoWd1KcUSFdUKtQFOxsxAOp8zIol/eAa+Qf/9HdWvj2gbxa9yfr0kWXV+Hi4VOeJJZKdgH/x3CmpF7sut2tln6mwoXVJfB5RjbWTHBvBDNYZPXTNSXiUC3CFpZdlu69Cu2xTcmOtygEfipBZQA1fHT1Sf1hYGjoD3nJUxtSBJHKS1k1yw+EVhiEkjjHWi4F5LPdIpjvCGm/eD1mmPQTQC5zO0r/zR2SlyUtShIFQyPJ3s5BaoU0wu8EbdQbiNUWL5NyFSPdA915nt2DOfwY9iyxpU4v/OTFf9P/wGnUtoc2DP4To8QsfQSMcE5Cw1X5smQcOaApYhVj2qCcwTPWzAqZ46iJ2zfrPawXGMHx+qZRuhVU9e+5IQ1lnUowFZa9kPNng+GsO0UrMeCYBuPdz8Zl1odnuWa4IHMWSujmkV68ewg0pjpydh3tIUitHfZhG488fLOrdQ0OonQy2u+XirsGoFfSz8FmxEu/rggdiMxLC1GNTrKeuU36Cx2mtHnl6wCw6vLUHAggh13TfuDNgb/uaT+Xqyzxk2X6Ya5yGBZPz4ZTbtShhBRlI8OlAsT4NUNbTEd2KrtRTUmRK8Gl1r7jrYtY5pPxm5A7Ux4/W8OVpP/r6Z30ystyQL+A16FkAs+lTBHOVShXITCUpgo3YRDuDGWPAUoGmslRp/qZz1WIEYsvKcytEV4n+1B92DZnveerN9md0kPe X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230022)(7916004)(376002)(346002)(396003)(136003)(366004)(39830400003)(451199015)(2906002)(8676002)(33716001)(66556008)(66946007)(86362001)(6916009)(316002)(54906003)(478600001)(6486002)(5660300002)(41300700001)(8936002)(38100700002)(6512007)(1076003)(186003)(6506007)(9686003)(4326008)(66476007)(81973001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?sn/idpsNd7bssk5guTGsVDBJj3J4BxAMc0uUi0ADxWVRPR2om3jPXnamSwPy?= =?us-ascii?Q?Wd7rJkSberqmGdmoi9bVelXcbn2m4qnrbl0zzSrlTnEc09TNnUYXrUFeTKFg?= =?us-ascii?Q?Q+Sskjc3E6t76Ue9G9/uOpz42sTtu2ZNpj0PIRcGI7PNc2SsTBPPtXYl68Wv?= =?us-ascii?Q?QOayCtcw0f/ybaPeURocnacJ36pw+EySxP85CPHUEMn28zVOdqPVJFYhXEJs?= =?us-ascii?Q?eCHpMGsyDgGn9Na1XHe3AXNStCwoawNYv/o+dbggYyAHcC+4N0wuj+rGOs4k?= =?us-ascii?Q?f4/1XwxYgVymmCdRvO1UQzN06JuWP9ZaADWwuRWI2TE5szsn1Vpr6d7jy4rW?= =?us-ascii?Q?HBpiq44afTnsNv3Ou0NG0lyHzJb5eQG5QP5bwbcig1LFc4biGhSPjKH8s6Bz?= =?us-ascii?Q?2M9hnniFZQPWH8NMUA3y6wF8VsMvJJ2w4ZQAqpAKQOgVxfGYFIkTtIaAYCUx?= =?us-ascii?Q?mPqyw/PUw+WqQUs+vKxOBiJz2z9STYR0AFkaED/1Ztj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Bf4moQwth1NExqklE4DmoA9L6hoVFbST33xUJ5oDQUPW2ujsg0?= =?us-ascii?Q?Bf3NcQL2zRYPAiz6qhFefoGI5ORC1ePSe+r3jqr+3R3tuFEO9flD+8NSbZlU?= =?us-ascii?Q?pjp8IXOCBt2EburQ2aSev9zL627tUXsnCTD4oxDqyXp6fv+O/kwKuoZ/JiI4?= =?us-ascii?Q?IXGsaan5BF8ObKQabBi2VxNV7EDUPuyCXL73p1ZC6vtTVuoWXs6DSkB3gDQx?= =?us-ascii?Q?Yw0qNjYppIXXSBHhaqUgSjqpLJkZa5RqT48vrRJ/1FJk?= X-OriginatorOrg: garyguo.net X-MS-Exchange-CrossTenant-Network-Message-Id: ab11f999-36db-43de-d465-08dac650bb42 X-MS-Exchange-CrossTenant-AuthSource: LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2022 14:58:46.8373 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bbc898ad-b10f-4e10-8552-d9377b823d45 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Mwm0wezDzkrcyhzhMEVdjOPxETY3LEcYUK48Ggt6Y/IPt6iB1UPtLX8ANczZG8wmFtMPJvcj5IGD3Knt5ObFtA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO3P265MB1915 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 10 Nov 2022 17:41:34 +0100 Miguel Ojeda wrote: > From: Wedson Almeida Filho > > Add the `fmt!` macro, which is a convenience alias for the Rust > `core::format_args!` macro. > > For instance, it may be used to create a `CString`: > > CString::try_from_fmt(fmt!("{}{}", "abc", 42))? > > Signed-off-by: Wedson Almeida Filho > [Reworded, adapted for upstream and applied latest changes] > Signed-off-by: Miguel Ojeda Reviewed-by: Gary Guo > --- > rust/kernel/str.rs | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs > index 877148b77e71..ffac633423db 100644 > --- a/rust/kernel/str.rs > +++ b/rust/kernel/str.rs > @@ -592,3 +592,9 @@ impl Deref for CString { > unsafe { CStr::from_bytes_with_nul_unchecked(self.buf.as_slice()) } > } > } > + > +/// A convenience alias for [`core::format_args`]. > +#[macro_export] > +macro_rules! fmt { > + ($($f:tt)*) => ( core::format_args!($($f)*) ) > +}