Skip to content

Commit b11c169

Browse files
committed
Fix clippy errors again
1 parent 29e33e2 commit b11c169

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

applications/shell/src/lib.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,7 @@ impl Shell {
14441444
fn display_content_slice(&mut self) -> Result<(), &'static str> {
14451445
// Calculate the last line to display. Make sure we don't extend over the end of the file.
14461446
let (_width, height) = self.terminal.lock().get_text_dimensions();
1447-
let mut line_end: usize = self.line_start + (height) - 5;
1447+
let mut line_end: usize = self.line_start + (height - 20);
14481448

14491449
if line_end > self.map.len() {
14501450
line_end = self.map.len();
@@ -1472,9 +1472,7 @@ impl Shell {
14721472
/// for each line. It stores index of each starting and ending char position of each line (separated by '\n)
14731473
fn parse_content(&mut self) {
14741474
// Get the width and height of the terminal screen.
1475-
let (width, height) = self.terminal.lock().get_text_dimensions();
1476-
1477-
self.terminal.lock().print_to_terminal(format!("{} {}\n", width, height).to_string());
1475+
let (width, _) = self.terminal.lock().get_text_dimensions();
14781476

14791477
// Number of the current line.
14801478
let mut cur_line_num: usize = 0;
@@ -1510,7 +1508,6 @@ impl Shell {
15101508
fn get_content_string(&mut self, file_path: String) {
15111509
let Ok(curr_wd) = task::with_current_task(|t| t.get_env().lock().working_dir.clone()) else {
15121510
self.terminal.lock().print_to_terminal("failed to get current task".to_string());
1513-
return;
15141511
};
15151512

15161513
let curr_dir = self.env.lock().working_dir.lock().get_absolute_path();
@@ -1525,7 +1522,6 @@ impl Shell {
15251522
// Checks if it is a directory
15261523
FileOrDir::Dir(directory) => {
15271524
self.terminal.lock().print_to_terminal(format!("{:?} a directory, cannot 'less' non-files.", directory.lock().get_name()));
1528-
return;
15291525
}
15301526
// Checks if it is a file and reads it into a utf8 string
15311527
FileOrDir::File(file) => {
@@ -1534,13 +1530,11 @@ impl Shell {
15341530
let mut string_slice_as_bytes = vec![0; file_size];
15351531
if let Err(_e) = file_locked.read_at(&mut string_slice_as_bytes, 0) {
15361532
self.terminal.lock().print_to_terminal("Failed to read error".to_string());
1537-
return;
15381533
}
15391534
let read_string = match str::from_utf8(&string_slice_as_bytes) {
15401535
Ok(string_slice) => string_slice,
15411536
Err(_utf8_err) => {
15421537
self.terminal.lock().print_to_terminal("File was not a printable UTF-8 text file".to_string());
1543-
return;
15441538
}
15451539
};
15461540
// Stores the content of the file as a string

0 commit comments

Comments
 (0)