From nobody Tue Feb 10 10:03:25 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1577171623; cv=none; d=zohomail.com; s=zohoarc; b=UnfAoVQAZKoGY+BznzF5kFnEAX3e/SZcWTBrEDnXixPmfkiyG0D8EzPHWKSsCO/xLur4Tvh6wxKDCq7/OVCb5Hfc/mqoT1WxbSZ1ECHJw1d5har2QEdc0ccPWLXItkGMaVcT97Gd4u1MHe3UNf7rHJQpK+nz/CkplOwdYI9fx+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577171623; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Za0zeSGr3TfrCS/k6+NXc1aMSndgAtQqtTsU3Xy0eu4=; b=RdiZUiwtOm5Vs6dPB7cgnYjBqtXYSHJx23dkzU9UP9iGMoBhBjr0P9LasNdh5zCO18vtaBtix9DSZz2DXyXqIKmPYb89YY74mDIbTk8tlKcK7PiJaYMde7BN8lxm9/nVkoC9CtSfnYWaHyntxzU1SUo5G1MtMlYtpSxaAA5NQ3k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1577171623574118.04563957810615; Mon, 23 Dec 2019 23:13:43 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-306-L7-ExMxUMbyaSi4L2i_UUA-1; Tue, 24 Dec 2019 02:13:39 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C92A4107ACCA; Tue, 24 Dec 2019 07:13:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A36ED6090B; Tue, 24 Dec 2019 07:13:34 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 63821825A1; Tue, 24 Dec 2019 07:13:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBO7D8Gq028188 for ; Tue, 24 Dec 2019 02:13:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id DE2BDC690C; Tue, 24 Dec 2019 07:13:08 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D973DC6910 for ; Tue, 24 Dec 2019 07:13:07 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B64D802884 for ; Tue, 24 Dec 2019 07:13:07 +0000 (UTC) Received: from balrog.mythic-beasts.com (balrog.mythic-beasts.com [46.235.227.24]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-64-L9YE3zZpP1akcuhaOx36fQ-1; Tue, 24 Dec 2019 02:13:05 -0500 Received: from [199.195.250.187] (port=44267 helo=hermes.aosc.io) by balrog.mythic-beasts.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1ijeNL-0001m0-OL; Tue, 24 Dec 2019 07:13:03 +0000 Received: from liushuyu.lan (unknown [172.22.1.1]) by hermes.aosc.io (Postfix) with ESMTPS id 138A943DD6; Tue, 24 Dec 2019 07:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577171622; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Za0zeSGr3TfrCS/k6+NXc1aMSndgAtQqtTsU3Xy0eu4=; b=Xxb7G6d13G2qcPGe15n7P3OFkI9FANNCgxI5d3SLIFGvsHPnzbYQYNWWNdYtS8L6YHD45a OgfHbLxD+Ib4iLE6iYE4KPm/lwkHwUourHJIlHy0vknmY6vWopMvZaxEmaYeUlfE3DuKPV ilaAOOsGT9usGmw8WxMqqAM6KzLVuYE= From: Zixing Liu To: libvir-list@redhat.com Date: Tue, 24 Dec 2019 00:12:55 -0700 Message-Id: <20191224071255.174037-6-liushuyu@aosc.io> In-Reply-To: <20191224071255.174037-1-liushuyu@aosc.io> References: <20191224071255.174037-1-liushuyu@aosc.io> MIME-Version: 1.0 X-Spamd-Result: default: False [0.62 / 15.00] BROKEN_CONTENT_TYPE(1.50)[] BAYES_HAM(-2.28)[98.85%] REPLY(-2.00)[] R_MISSING_CHARSET(2.50)[] MID_CONTAINS_FROM(1.00)[] TO_DN_ALL(0.00)[] FROM_EQ_ENVFROM(0.00)[] MAILCOW_MOO(0.00)[] ASN(0.00)[asn:56300, ipnet:172.22.1.1/32, country:SG] FROM_HAS_DN(0.00)[] TO_MATCH_ENVRCPT_ALL(0.00)[] RCPT_COUNT_THREE(0.00)[3] RCVD_COUNT_TWO(0.00)[2] MIME_GOOD(-0.10)[text/plain] X-Rspamd-Server: rspamd X-Rspamd-Scan-Time: 0.01 X-Rspamd-Queue-ID: 138A943DD6 X-BlackCat-Spam-Score: 50 X-Spam-Status: No, score=5.0 X-MC-Unique: L9YE3zZpP1akcuhaOx36fQ-1 X-MC-Unique: L7-ExMxUMbyaSi4L2i_UUA-1 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xBO7D8Gq028188 X-loop: libvir-list@redhat.com Cc: Zixing Liu , sahid.ferdjaoui@canonical.com Subject: [libvirt] [rust PATCH v2 5/5] libvirt-rust: stream: addressed comments X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" * minimized unsafe scope * removed pub from `from_ptr` function Signed-off-by: Zixing Liu Reviewed-by: Sahid Orentino Ferdjaoui --- src/stream.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/stream.rs b/src/stream.rs index 0d84fd7..ea623f6 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -114,16 +114,14 @@ impl Drop for Stream { =20 impl Stream { pub fn new(conn: &Connect, flags: StreamFlags) -> Result { - unsafe { - let ptr =3D virStreamNew(conn.as_ptr(), flags as libc::c_uint); - if ptr.is_null() { - return Err(Error::new()); - } - return Ok(Stream::from_ptr(ptr)); + let ptr =3D unsafe { virStreamNew(conn.as_ptr(), flags as libc::c_= uint) }; + if ptr.is_null() { + return Err(Error::new()); } + return Ok(Stream::from_ptr(ptr)); } =20 - pub fn from_ptr(ptr: sys::virStreamPtr) -> Stream { + fn from_ptr(ptr: sys::virStreamPtr) -> Stream { Stream { ptr: Some(ptr), callback: None, @@ -139,9 +137,9 @@ impl Stream { if virStreamFree(self.as_ptr()) =3D=3D -1 { return Err(Error::new()); } - self.ptr =3D None; - return Ok(()); } + self.ptr =3D None; + return Ok(()); } =20 pub fn finish(self) -> Result<(), Error> { --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list