Fix clippy::len_zero
lint style violations (#36589)
Related: #36577 Release Notes: - N/A --------- Signed-off-by: Umesh Yadav <git@umesh.dev>
This commit is contained in:
parent
92352f97ad
commit
1e6cefaa56
24 changed files with 46 additions and 46 deletions
|
@ -1113,9 +1113,8 @@ impl RunningState {
|
|||
};
|
||||
let session = self.session.read(cx);
|
||||
|
||||
let cwd = Some(&request.cwd)
|
||||
.filter(|cwd| cwd.len() > 0)
|
||||
.map(PathBuf::from)
|
||||
let cwd = (!request.cwd.is_empty())
|
||||
.then(|| PathBuf::from(&request.cwd))
|
||||
.or_else(|| session.binary().unwrap().cwd.clone());
|
||||
|
||||
let mut envs: HashMap<String, String> =
|
||||
|
@ -1150,7 +1149,7 @@ impl RunningState {
|
|||
} else {
|
||||
None
|
||||
}
|
||||
} else if args.len() > 0 {
|
||||
} else if !args.is_empty() {
|
||||
Some(args.remove(0))
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -244,7 +244,7 @@ impl BreakpointList {
|
|||
return;
|
||||
}
|
||||
let ix = match self.selected_ix {
|
||||
_ if self.breakpoints.len() == 0 => None,
|
||||
_ if self.breakpoints.is_empty() => None,
|
||||
None => Some(0),
|
||||
Some(ix) => {
|
||||
if ix == self.breakpoints.len() - 1 {
|
||||
|
@ -268,7 +268,7 @@ impl BreakpointList {
|
|||
return;
|
||||
}
|
||||
let ix = match self.selected_ix {
|
||||
_ if self.breakpoints.len() == 0 => None,
|
||||
_ if self.breakpoints.is_empty() => None,
|
||||
None => Some(self.breakpoints.len() - 1),
|
||||
Some(ix) => {
|
||||
if ix == 0 {
|
||||
|
@ -286,7 +286,7 @@ impl BreakpointList {
|
|||
cx.propagate();
|
||||
return;
|
||||
}
|
||||
let ix = if self.breakpoints.len() > 0 {
|
||||
let ix = if !self.breakpoints.is_empty() {
|
||||
Some(0)
|
||||
} else {
|
||||
None
|
||||
|
@ -299,7 +299,7 @@ impl BreakpointList {
|
|||
cx.propagate();
|
||||
return;
|
||||
}
|
||||
let ix = if self.breakpoints.len() > 0 {
|
||||
let ix = if !self.breakpoints.is_empty() {
|
||||
Some(self.breakpoints.len() - 1)
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -223,7 +223,7 @@ impl ModuleList {
|
|||
|
||||
fn select_next(&mut self, _: &menu::SelectNext, _window: &mut Window, cx: &mut Context<Self>) {
|
||||
let ix = match self.selected_ix {
|
||||
_ if self.entries.len() == 0 => None,
|
||||
_ if self.entries.is_empty() => None,
|
||||
None => Some(0),
|
||||
Some(ix) => {
|
||||
if ix == self.entries.len() - 1 {
|
||||
|
@ -243,7 +243,7 @@ impl ModuleList {
|
|||
cx: &mut Context<Self>,
|
||||
) {
|
||||
let ix = match self.selected_ix {
|
||||
_ if self.entries.len() == 0 => None,
|
||||
_ if self.entries.is_empty() => None,
|
||||
None => Some(self.entries.len() - 1),
|
||||
Some(ix) => {
|
||||
if ix == 0 {
|
||||
|
@ -262,7 +262,7 @@ impl ModuleList {
|
|||
_window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
let ix = if self.entries.len() > 0 {
|
||||
let ix = if !self.entries.is_empty() {
|
||||
Some(0)
|
||||
} else {
|
||||
None
|
||||
|
@ -271,7 +271,7 @@ impl ModuleList {
|
|||
}
|
||||
|
||||
fn select_last(&mut self, _: &menu::SelectLast, _window: &mut Window, cx: &mut Context<Self>) {
|
||||
let ix = if self.entries.len() > 0 {
|
||||
let ix = if !self.entries.is_empty() {
|
||||
Some(self.entries.len() - 1)
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -621,7 +621,7 @@ impl StackFrameList {
|
|||
|
||||
fn select_next(&mut self, _: &menu::SelectNext, _window: &mut Window, cx: &mut Context<Self>) {
|
||||
let ix = match self.selected_ix {
|
||||
_ if self.entries.len() == 0 => None,
|
||||
_ if self.entries.is_empty() => None,
|
||||
None => Some(0),
|
||||
Some(ix) => {
|
||||
if ix == self.entries.len() - 1 {
|
||||
|
@ -641,7 +641,7 @@ impl StackFrameList {
|
|||
cx: &mut Context<Self>,
|
||||
) {
|
||||
let ix = match self.selected_ix {
|
||||
_ if self.entries.len() == 0 => None,
|
||||
_ if self.entries.is_empty() => None,
|
||||
None => Some(self.entries.len() - 1),
|
||||
Some(ix) => {
|
||||
if ix == 0 {
|
||||
|
@ -660,7 +660,7 @@ impl StackFrameList {
|
|||
_window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
let ix = if self.entries.len() > 0 {
|
||||
let ix = if !self.entries.is_empty() {
|
||||
Some(0)
|
||||
} else {
|
||||
None
|
||||
|
@ -669,7 +669,7 @@ impl StackFrameList {
|
|||
}
|
||||
|
||||
fn select_last(&mut self, _: &menu::SelectLast, _window: &mut Window, cx: &mut Context<Self>) {
|
||||
let ix = if self.entries.len() > 0 {
|
||||
let ix = if !self.entries.is_empty() {
|
||||
Some(self.entries.len() - 1)
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -291,7 +291,7 @@ impl VariableList {
|
|||
}
|
||||
|
||||
self.session.update(cx, |session, cx| {
|
||||
session.variables(scope.variables_reference, cx).len() > 0
|
||||
!session.variables(scope.variables_reference, cx).is_empty()
|
||||
})
|
||||
})
|
||||
.map(|scope| {
|
||||
|
@ -997,7 +997,7 @@ impl VariableList {
|
|||
DapEntry::Watcher { .. } => continue,
|
||||
DapEntry::Variable(dap) => scopes[idx].1.push(dap.clone()),
|
||||
DapEntry::Scope(scope) => {
|
||||
if scopes.len() > 0 {
|
||||
if !scopes.is_empty() {
|
||||
idx += 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue