From 62387c464fe4e9ea605683a3a041f7e31fb723fd Mon Sep 17 00:00:00 2001 From: Weijie Guo Date: Mon, 15 Apr 2024 18:58:15 +0800 Subject: [PATCH] refactor --- crates/polars-core/src/frame/group_by/mod.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/crates/polars-core/src/frame/group_by/mod.rs b/crates/polars-core/src/frame/group_by/mod.rs index 0240b4a023d3..438c3c24fd74 100644 --- a/crates/polars-core/src/frame/group_by/mod.rs +++ b/crates/polars-core/src/frame/group_by/mod.rs @@ -76,16 +76,14 @@ impl DataFrame { .cloned() .collect::>(); if by.is_empty() { - Ok(if self.height() == 0 { - GroupsProxy::Slice { - groups: vec![], - rolling: false, - } + let groups = if self.height() == 0 { + vec![] } else { - GroupsProxy::Slice { - groups: vec![[0, self.height() as IdxSize]], - rolling: false, - } + vec![[0, self.height() as IdxSize]] + }; + Ok(GroupsProxy::Slice { + groups, + rolling: false, }) } else { let rows = if multithreaded {