Message ID | 20240131-doc-fixes-v3-v3-6-0c8af94ed7de@valentinobst.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-47070-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp4800dyc; Wed, 31 Jan 2024 12:29:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4scuAd8p4yzRdog7WYEMqiA/q6F6naX5Sz8QzoODwG13o3vkgJbvtq624TQeQzxnWdg79 X-Received: by 2002:a05:6a00:1792:b0:6de:8ad:dad1 with SMTP id s18-20020a056a00179200b006de08addad1mr3598745pfg.19.1706732967058; Wed, 31 Jan 2024 12:29:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706732967; cv=pass; d=google.com; s=arc-20160816; b=VF11CmoVR85+D9bMg8Jw9QZKiaLZPGnfqiRsUuBO4SXosAtZMfnB3SiWiQBIsju01j NwjORQMWY+Ly6xHgYuRdYTxImUA6Y4YR6/ciHyw01l8IhsAAJEIO5C8zGMA7VtkS32oK ikgDMo9UXGNkIFVKemJJgYLRAqV1Dp2+MlMwV0otsfS1sMIMfeTKLaFYrq8pSk8BE/TF ljZHdwhEZH4xG2IJ/ku9T3VqXfgdPRAKaRgzwJBVC5cJSo18UQHGVpiHBqZEDWnMQzAC yN4USc9GCWKLJX8CmBNHnnub0P4IAV8FkUql5AlL3nmtTvza5dX4LnAfnXbQ0RqSMEHZ rfrg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=KYug1IAVuqqYROXD6jjglOs4fsIk1n/6aBmZDRutRxY=; fh=vTj4Km4DYf3VWrqzU/BEdaiapvWynMkX3iMDDcHBGEQ=; b=tX7WsEacgDpn/3hFUo7oYNfjfQHs2rSBt+vtg36PURSXtGqRCZu9k9iw3KzqHGHWek njaRplOtlNWU8T5PsLg5vfORmD8x9JXdNJNA9f2rX+RVyG+uG3zQQTOfV99vu0v/tE1f 65n+26O96bQGO0gezSCk4wKtlM/oLsZfHepyn8QVsusDt25oxJvyAJQ3aJ7eLcoEJ2FD 01U3emW9WB7Z8oGF4P7yYWGe9IKLmcbooxQEdLnlYvyXKPeMbiCOqQo/1rJrWlB4GN4s WOl/WZ8vVbhXTyJj6p8A6MuwC0kx896RXxWpLC0o7zPoh363gav4Hx032CqBSMz8gcE8 VZGw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OuwgKaRI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47070-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47070-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCWtsdHOJP13iaVCWPKDdujIj0mfSwfKk0eCye7aX5c0VdQTV5tjJTTF6inY1vLgi/FZyI/TvxpwnzKQ7ogxNSHEAYnmAw== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t14-20020a65608e000000b005d8e280c876si4181918pgu.729.2024.01.31.12.29.26 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 12:29:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47070-ouuuleilei=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=@kernel.org header.s=k20201202 header.b=OuwgKaRI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47070-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47070-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 BB324B25C49 for <ouuuleilei@gmail.com>; Wed, 31 Jan 2024 20:28:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE8E813BE8E; Wed, 31 Jan 2024 20:24:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OuwgKaRI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 873DB3FB10; Wed, 31 Jan 2024 20:24:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706732649; cv=none; b=IQmyLNfK9s9rhVpHtAGXds34McCkaZZPm+KENdXXKQLQMToDeLdupaeq+unKBuskKmPNDeZUx9w5LxIeG4p89htXxFRePWWix41l0vOsgRl7LRRPdpkMBhxTVDMpGcG+v1K44px5wKs7BBuyAwUP6zTQane3/kTpYYXs1tczJB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706732649; c=relaxed/simple; bh=qvu+Ox0zu6pevZi9vcwFq2laTuQ829Sreeg9+Gf9HMA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ha4CUTaAZ9GRhvTUOGYHn50lLJ0SL1CzkQxkyEr4GUYhdObWtpIGS8AKYKzQei2HM5oFHWcZbh+feRwT6ddaekj7EFJjtBmAO4R1x0Fome5NXwfdomW9tUxNu5xkB17a6vr/5IkG4VvkWpQYCAH6ae2gTaVUqXwepAk/W6gQBIU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OuwgKaRI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 0167CC43609; Wed, 31 Jan 2024 20:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706732649; bh=qvu+Ox0zu6pevZi9vcwFq2laTuQ829Sreeg9+Gf9HMA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=OuwgKaRINXpUT2P3BU1WdF1vAyAXW3peXAdlYywNwt14Min7HHn7HD+6DU52/R/Z+ S/46KIJhqMw0JQsMvCD/rAVXWkthWfTH7thRZDYiG1tZwwITgxXRjmGUWYJKpN87og R6linx8xN+ucJpMVLwgW1eWRb5AAZ4JIM5y8KnK0KNS+o0nt7JEewgL0tzAVUnXqLb wU823bsaRnkJ3utxA0se8DmZ2RrdEcUJxcBisNyDL3fRPs3Y8gEFCoIpYnB4109SeV JqItdzw8Rq4kdq8m2RczMbzW3Zjlj4boiKzmnFhf68w7YS7+nK2mq2SXQfUtDViM3h 4q5o4Cke4OxOw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1D52C47258; Wed, 31 Jan 2024 20:24:08 +0000 (UTC) From: Valentin Obst via B4 Relay <devnull+kernel.valentinobst.de@kernel.org> Date: Wed, 31 Jan 2024 21:23:28 +0100 Subject: [PATCH v3 06/12] rust: str: move SAFETY comment in front of unsafe block Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240131-doc-fixes-v3-v3-6-0c8af94ed7de@valentinobst.de> References: <20240131-doc-fixes-v3-v3-0-0c8af94ed7de@valentinobst.de> In-Reply-To: <20240131-doc-fixes-v3-v3-0-0c8af94ed7de@valentinobst.de> To: Miguel Ojeda <ojeda@kernel.org>, Alex Gaynor <alex.gaynor@gmail.com>, Wedson Almeida Filho <wedsonaf@gmail.com>, Boqun Feng <boqun.feng@gmail.com>, Gary Guo <gary@garyguo.net>, =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@protonmail.com>, Benno Lossin <benno.lossin@proton.me>, Andreas Hindborg <a.hindborg@samsung.com>, Alice Ryhl <aliceryhl@google.com> Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Valentin Obst <kernel@valentinobst.de>, Trevor Gross <tmgross@umich.edu>, Martin Rodriguez Reboredo <yakoyoku@gmail.com> X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706732646; l=1018; i=kernel@valentinobst.de; s=20240131; h=from:subject:message-id; bh=DDoG48Qq56LKmbADR58N8ly1qfgI3wpt9bk2atcwP2I=; b=MZe2Hxv9roGYl7lqeSTsKZTqoSJKgkFsgca/PD3aFOr4ulKBTBblhv38PbvagOpZGWXWbWtyj YNvZipM8WUGDw3pFzMQXX3OxChgETuOQVPLM3td+l4AGy5t/ZaHB/O5 X-Developer-Key: i=kernel@valentinobst.de; a=ed25519; pk=3s7U8y0mqkaiurgHSQQTYWOo2tw5HgzCg5vnJVfw37Y= X-Endpoint-Received: by B4 Relay for kernel@valentinobst.de/20240131 with auth_id=124 X-Original-From: Valentin Obst <kernel@valentinobst.de> Reply-To: <kernel@valentinobst.de> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789639227924616559 X-GMAIL-MSGID: 1789639227924616559 |
Series |
rust: kernel: documentation improvements
|
|
Commit Message
Valentin Obst via B4 Relay
Jan. 31, 2024, 8:23 p.m. UTC
From: Valentin Obst <kernel@valentinobst.de> SAFETY comments should immediately precede the unsafe block they justify. Move assignment to `bar` past comment as it is safe. Signed-off-by: Valentin Obst <kernel@valentinobst.de> Reviewed-by: Trevor Gross <tmgross@umich.edu> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> --- rust/kernel/str.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index 843ffeec9b3e..fec5c4314758 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -191,9 +191,9 @@ pub fn to_str(&self) -> Result<&str, core::str::Utf8Error> { /// ``` /// # use kernel::c_str; /// # use kernel::str::CStr; + /// let bar = c_str!("ツ"); /// // SAFETY: String literals are guaranteed to be valid UTF-8 /// // by the Rust compiler. - /// let bar = c_str!("ツ"); /// assert_eq!(unsafe { bar.as_str_unchecked() }, "ツ"); /// ``` #[inline]