Browse Source

Apply cargo check suggestions

Apply nightly lints
I updated my toolchain to 1.66-nightly to fix all the files
pull/78/head
TechiePi 2 years ago
parent
commit
accf99b2bb
  1. 2
      ctru-rs/build.rs
  2. 14
      ctru-rs/examples/file-explorer.rs
  3. 2
      ctru-rs/examples/hashmaps.rs
  4. 10
      ctru-rs/examples/network-sockets.rs
  5. 2
      ctru-rs/examples/software-keyboard.rs
  6. 4
      ctru-rs/examples/time-rtc.rs
  7. 6
      ctru-rs/src/error.rs
  8. 2
      ctru-rs/src/services/fs.rs

2
ctru-rs/build.rs

@ -28,5 +28,5 @@ fn main() { @@ -28,5 +28,5 @@ fn main() {
println!("cargo:rustc-cfg=romfs_exists");
}
println!("cargo:rerun-if-changed={}", manifest_dir);
println!("cargo:rerun-if-changed={manifest_dir}");
}

14
ctru-rs/examples/file-explorer.rs

@ -96,7 +96,7 @@ impl<'a> FileExplorer<'a> { @@ -96,7 +96,7 @@ impl<'a> FileExplorer<'a> {
}
}
Err(e) => {
println!("Failed to read {}: {}", self.path.display(), e)
println!("Failed to read {}: {e}", self.path.display())
}
};
@ -110,7 +110,7 @@ impl<'a> FileExplorer<'a> { @@ -110,7 +110,7 @@ impl<'a> FileExplorer<'a> {
for (i, entry) in dir_listing.enumerate() {
match entry {
Ok(entry) => {
println!("{:2} - {}", i, entry.file_name().to_string_lossy());
println!("{i:2} - {}", entry.file_name().to_string_lossy());
self.entries.push(entry);
if (i + 1) % 20 == 0 {
@ -118,7 +118,7 @@ impl<'a> FileExplorer<'a> { @@ -118,7 +118,7 @@ impl<'a> FileExplorer<'a> {
}
}
Err(e) => {
println!("{} - Error: {}", i, e);
println!("{i} - Error: {e}");
}
}
}
@ -132,7 +132,7 @@ impl<'a> FileExplorer<'a> { @@ -132,7 +132,7 @@ impl<'a> FileExplorer<'a> {
println!("{0:->80}", "");
}
Err(err) => {
println!("Error reading file: {}", err);
println!("Error reading file: {err}");
}
}
}
@ -175,7 +175,7 @@ impl<'a> FileExplorer<'a> { @@ -175,7 +175,7 @@ impl<'a> FileExplorer<'a> {
unreachable!()
}
Err(e) => {
panic!("Error: {:?}", e)
panic!("Error: {e:?}")
}
}
}
@ -184,7 +184,7 @@ impl<'a> FileExplorer<'a> { @@ -184,7 +184,7 @@ impl<'a> FileExplorer<'a> {
let next_path_index: usize = match next_path_index.parse() {
Ok(index) => index,
Err(e) => {
println!("Number parsing error: {}", e);
println!("Number parsing error: {e}");
return;
}
};
@ -205,7 +205,7 @@ impl<'a> FileExplorer<'a> { @@ -205,7 +205,7 @@ impl<'a> FileExplorer<'a> {
fn set_exact_path(&mut self, new_path_str: String) {
let new_path = Path::new(&new_path_str);
if !new_path.is_dir() {
println!("Not a directory: {}", new_path_str);
println!("Not a directory: {new_path_str}");
return;
}

2
ctru-rs/examples/hashmaps.rs

@ -17,7 +17,7 @@ fn main() { @@ -17,7 +17,7 @@ fn main() {
map.insert("Another key?", 543);
map.remove("A Key!");
println!("{:#?}", map);
println!("{map:#?}");
while apt.main_loop() {
gfx.flush_buffers();

10
ctru-rs/examples/network-sockets.rs

@ -25,19 +25,19 @@ fn main() { @@ -25,19 +25,19 @@ fn main() {
match server.accept() {
Ok((mut stream, socket_addr)) => {
println!("Got connection from {}", socket_addr);
println!("Got connection from {socket_addr}");
let mut buf = [0u8; 4096];
match stream.read(&mut buf) {
Ok(_) => {
let req_str = String::from_utf8_lossy(&buf);
println!("{}", req_str);
println!("{req_str}");
}
Err(e) => {
if e.kind() == io::ErrorKind::WouldBlock {
println!("Note: Reading the connection returned ErrorKind::WouldBlock.")
} else {
println!("Unable to read stream: {}", e)
println!("Unable to read stream: {e}")
}
}
}
@ -45,7 +45,7 @@ fn main() { @@ -45,7 +45,7 @@ fn main() {
let response = b"HTTP/1.1 200 OK\r\nContent-Type: text/html; charset=UTF-8\r\n\r\n<html><body>Hello world</body></html>\r\n";
if let Err(e) = stream.write(response) {
println!("Error writing http response: {}", e);
println!("Error writing http response: {e}");
}
stream.shutdown(Shutdown::Both).unwrap();
@ -53,7 +53,7 @@ fn main() { @@ -53,7 +53,7 @@ fn main() {
Err(e) => match e.kind() {
std::io::ErrorKind::WouldBlock => {}
_ => {
println!("Error accepting connection: {}", e);
println!("Error accepting connection: {e}");
std::thread::sleep(Duration::from_secs(2));
}
},

2
ctru-rs/examples/software-keyboard.rs

@ -29,7 +29,7 @@ fn main() { @@ -29,7 +29,7 @@ fn main() {
// Raise the software keyboard. You can perform different actions depending on which
// software button the user pressed
match keyboard.get_utf8(&mut text) {
Ok(Button::Right) => println!("You entered: {}", text),
Ok(Button::Right) => println!("You entered: {text}"),
Ok(Button::Left) => println!("Cancelled"),
Ok(Button::Middle) => println!("How did you even press this?"),
Err(_) => println!("Oh noes, an error happened!"),

4
ctru-rs/examples/time-rtc.rs

@ -33,8 +33,8 @@ fn main() { @@ -33,8 +33,8 @@ fn main() {
let day = cur_time.day();
let year = cur_time.year();
println!("\x1b[1;1H{:0>2}:{:0>2}:{:0>2}", hours, minutes, seconds);
println!("{} {} {} {}", weekday, month, day, year);
println!("\x1b[1;1H{hours:0>2}:{minutes:0>2}:{seconds:0>2}");
println!("{weekday} {month} {day} {year}");
// Flush and swap framebuffers
gfx.flush_buffers();

6
ctru-rs/src/error.rs

@ -87,7 +87,7 @@ impl fmt::Debug for Error { @@ -87,7 +87,7 @@ impl fmt::Debug for Error {
match self {
&Self::Os(err) => f
.debug_struct("Error")
.field("raw", &format_args!("{:#08X}", err))
.field("raw", &format_args!("{err:#08X}"))
.field("description", &R_DESCRIPTION(err))
.field("module", &R_MODULE(err))
.field("summary", &R_SUMMARY(err))
@ -106,8 +106,8 @@ impl fmt::Debug for Error { @@ -106,8 +106,8 @@ impl fmt::Debug for Error {
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
&Self::Os(err) => write!(f, "libctru result code: 0x{:08X}", err),
Self::Libc(err) => write!(f, "{}", err),
&Self::Os(err) => write!(f, "libctru result code: 0x{err:08X}"),
Self::Libc(err) => write!(f, "{err}"),
Self::ServiceAlreadyActive => write!(f, "Service already active"),
Self::OutputAlreadyRedirected => {
write!(f, "output streams are already redirected to 3dslink")

2
ctru-rs/src/services/fs.rs

@ -669,7 +669,7 @@ impl<'a> DirEntry<'a> { @@ -669,7 +669,7 @@ impl<'a> DirEntry<'a> {
/// The full path is created by joining the original path to `read_dir`
/// with the filename of this entry.
pub fn path(&self) -> PathBuf {
self.root.join(&self.file_name())
self.root.join(self.file_name())
}
/// Return the metadata for the file that this entry points at.

Loading…
Cancel
Save