Skip to content

Commit a589745

Browse files
authored
fix: corrected a variable name (#51)
1 parent 5674fb3 commit a589745

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/help/mod.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct Block {
2222
indent: usize,
2323
margin_left: usize,
2424
margin_right: usize,
25-
bodys: Vec<(usize, String)>, // The vector of tuples of (first indent, text)
25+
bodies: Vec<(usize, String)>, // The vector of tuples of (first indent, text)
2626

2727
_spaces: String,
2828
}
@@ -94,7 +94,7 @@ impl Help {
9494
indent: indent,
9595
margin_left: margin_left,
9696
margin_right: margin_right,
97-
bodys: vec![(0, text)],
97+
bodies: vec![(0, text)],
9898
_spaces: " ".repeat(max_len),
9999
};
100100
self.blocks.push(block);
@@ -153,7 +153,7 @@ impl Help {
153153
indent: indent,
154154
margin_left: margin_left,
155155
margin_right: margin_right,
156-
bodys: texts.into_iter().map(|s| (0, s)).collect(),
156+
bodies: texts.into_iter().map(|s| (0, s)).collect(),
157157
_spaces: " ".repeat(max_len),
158158
};
159159
self.blocks.push(block);
@@ -208,10 +208,10 @@ impl Help {
208208
margin_right: usize,
209209
) {
210210
let mut indent = indent;
211-
let bodys = opts::create_opts_help(cfgs, &mut indent);
211+
let bodies = opts::create_opts_help(cfgs, &mut indent);
212212

213213
let mut max_len = 0;
214-
for (i, _) in &bodys {
214+
for (i, _) in &bodies {
215215
max_len = cmp::max(max_len, *i);
216216
}
217217

@@ -223,7 +223,7 @@ impl Help {
223223
indent: indent,
224224
margin_left: margin_left,
225225
margin_right: margin_right,
226-
bodys: bodys,
226+
bodies: bodies,
227227
_spaces: " ".repeat(max_len),
228228
};
229229
self.blocks.push(block);
@@ -267,7 +267,7 @@ pub struct HelpIter<'a> {
267267
}
268268

269269
struct BlockIter<'a> {
270-
bodys: &'a [(usize, String)],
270+
bodies: &'a [(usize, String)],
271271
index: usize,
272272
indent: &'a str,
273273
margin: &'a str,
@@ -295,14 +295,14 @@ impl Iterator for HelpIter<'_> {
295295
impl<'a> BlockIter<'a> {
296296
fn new(block: &'a Block, line_width: usize) -> Self {
297297
let print_width = line_width - block.margin_left - block.margin_right;
298-
if block.bodys.is_empty() || print_width <= block.indent {
298+
if block.bodies.is_empty() || print_width <= block.indent {
299299
return Self::empty();
300300
}
301-
let (indent, text) = &block.bodys[0];
301+
let (indent, text) = &block.bodies[0];
302302
let mut line_iter = linebreak::LineIter::new(&text, print_width);
303303
line_iter.set_indent(&block._spaces[0..(*indent)]);
304304
Self {
305-
bodys: &block.bodys,
305+
bodies: &block.bodies,
306306
index: 0,
307307
indent: &(&block._spaces)[0..block.indent],
308308
margin: &(&block._spaces)[0..block.margin_left],
@@ -312,7 +312,7 @@ impl<'a> BlockIter<'a> {
312312

313313
fn empty() -> Self {
314314
Self {
315-
bodys: &[] as &'a [(usize, String)],
315+
bodies: &[] as &'a [(usize, String)],
316316
index: 0,
317317
indent: "",
318318
margin: "",
@@ -325,7 +325,7 @@ impl<'a> Iterator for BlockIter<'a> {
325325
type Item = String;
326326

327327
fn next(&mut self) -> Option<String> {
328-
if self.bodys.is_empty() {
328+
if self.bodies.is_empty() {
329329
return None;
330330
}
331331

@@ -337,11 +337,11 @@ impl<'a> Iterator for BlockIter<'a> {
337337
}
338338

339339
self.index += 1;
340-
if self.index >= self.bodys.len() {
340+
if self.index >= self.bodies.len() {
341341
break;
342342
}
343343

344-
let (indent, text) = &self.bodys[self.index];
344+
let (indent, text) = &self.bodies[self.index];
345345
self.line_iter.init(&text);
346346
self.line_iter.set_indent(&self.indent[0..(*indent)]);
347347
}

0 commit comments

Comments
 (0)