fixup: zellij-server: fix compiler warnings (#2873)
* fixup: zellij-server: fix compiler warnings Fixes compiler warnings about variables not being read before being reassigned a value, and an unused variable. Removes unnecessary intermediate local variables. * style(fmt): rustfmt --------- Co-authored-by: Jae-Heon Ji <atx6419@gmail.com>
This commit is contained in:
parent
9a38ad2e15
commit
4a351e22be
1 changed files with 22 additions and 24 deletions
|
|
@ -580,18 +580,17 @@ impl ServerOsApi for ServerOsInputOutput {
|
||||||
.lock()
|
.lock()
|
||||||
.to_anyhow()
|
.to_anyhow()
|
||||||
.with_context(err_context)?;
|
.with_context(err_context)?;
|
||||||
let mut terminal_id = None;
|
let terminal_id = self
|
||||||
{
|
|
||||||
let current_ids: BTreeSet<u32> = self
|
|
||||||
.terminal_id_to_raw_fd
|
.terminal_id_to_raw_fd
|
||||||
.lock()
|
.lock()
|
||||||
.to_anyhow()
|
.to_anyhow()
|
||||||
.with_context(err_context)?
|
.with_context(err_context)?
|
||||||
.keys()
|
.keys()
|
||||||
.copied()
|
.copied()
|
||||||
.collect();
|
.collect::<BTreeSet<u32>>()
|
||||||
terminal_id = current_ids.last().map(|l| l + 1).or(Some(0));
|
.last()
|
||||||
}
|
.map(|l| l + 1)
|
||||||
|
.or(Some(0));
|
||||||
match terminal_id {
|
match terminal_id {
|
||||||
Some(terminal_id) => {
|
Some(terminal_id) => {
|
||||||
self.terminal_id_to_raw_fd
|
self.terminal_id_to_raw_fd
|
||||||
|
|
@ -622,18 +621,17 @@ impl ServerOsApi for ServerOsInputOutput {
|
||||||
fn reserve_terminal_id(&self) -> Result<u32> {
|
fn reserve_terminal_id(&self) -> Result<u32> {
|
||||||
let err_context = || "failed to reserve a terminal ID".to_string();
|
let err_context = || "failed to reserve a terminal ID".to_string();
|
||||||
|
|
||||||
let mut terminal_id = None;
|
let terminal_id = self
|
||||||
{
|
|
||||||
let current_ids: BTreeSet<u32> = self
|
|
||||||
.terminal_id_to_raw_fd
|
.terminal_id_to_raw_fd
|
||||||
.lock()
|
.lock()
|
||||||
.to_anyhow()
|
.to_anyhow()
|
||||||
.with_context(err_context)?
|
.with_context(err_context)?
|
||||||
.keys()
|
.keys()
|
||||||
.copied()
|
.copied()
|
||||||
.collect();
|
.collect::<BTreeSet<u32>>()
|
||||||
terminal_id = current_ids.last().map(|l| l + 1).or(Some(0));
|
.last()
|
||||||
}
|
.map(|l| l + 1)
|
||||||
|
.or(Some(0));
|
||||||
match terminal_id {
|
match terminal_id {
|
||||||
Some(terminal_id) => {
|
Some(terminal_id) => {
|
||||||
self.terminal_id_to_raw_fd
|
self.terminal_id_to_raw_fd
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue