diff --git a/ctru-rs/examples/buttons.rs b/ctru-rs/examples/buttons.rs index 7d00765..23986da 100644 --- a/ctru-rs/examples/buttons.rs +++ b/ctru-rs/examples/buttons.rs @@ -1,7 +1,5 @@ -extern crate ctru; - -use ctru::gfx::Gfx; use ctru::console::Console; +use ctru::gfx::Gfx; use ctru::services::apt::Apt; use ctru::services::hid::{Hid, KeyPad}; @@ -29,7 +27,6 @@ fn main() { // We only want to print when the keys we're holding now are different // from what they were on the previous frame if keys != old_keys { - // Clear the screen console.clear(); @@ -62,7 +59,7 @@ fn main() { } if keys.intersects(KeyPad::KEY_START) { println!("See ya!"); - break + break; } } diff --git a/ctru-rs/examples/hello-both-screens.rs b/ctru-rs/examples/hello-both-screens.rs index 84e9f31..51f04d8 100644 --- a/ctru-rs/examples/hello-both-screens.rs +++ b/ctru-rs/examples/hello-both-screens.rs @@ -1,7 +1,5 @@ -extern crate ctru; - -use ctru::gfx::{Gfx, Screen}; use ctru::console::Console; +use ctru::gfx::{Gfx, Screen}; use ctru::services::apt::Apt; use ctru::services::hid::{Hid, KeyPad}; diff --git a/ctru-rs/examples/hello-world.rs b/ctru-rs/examples/hello-world.rs index ced5e4b..68f6f38 100644 --- a/ctru-rs/examples/hello-world.rs +++ b/ctru-rs/examples/hello-world.rs @@ -1,7 +1,5 @@ -extern crate ctru; - -use ctru::gfx::Gfx; use ctru::console::Console; +use ctru::gfx::Gfx; use ctru::services::apt::Apt; use ctru::services::hid::{Hid, KeyPad}; @@ -36,7 +34,6 @@ fn main() { // Main application loop. while apt.main_loop() { - // Flushes and swaps the framebuffers when double-buffering // is enabled gfx.flush_buffers(); diff --git a/ctru-rs/examples/software-keyboard.rs b/ctru-rs/examples/software-keyboard.rs index 3312dbb..7b4e4ca 100644 --- a/ctru-rs/examples/software-keyboard.rs +++ b/ctru-rs/examples/software-keyboard.rs @@ -1,10 +1,8 @@ -extern crate ctru; - -use ctru::gfx::Gfx; +use ctru::applets::swkbd::{Button, Swkbd}; use ctru::console::Console; +use ctru::gfx::Gfx; use ctru::services::apt::Apt; use ctru::services::hid::{Hid, KeyPad}; -use ctru::applets::swkbd::{Swkbd, Button}; fn main() { ctru::init(); @@ -34,10 +32,10 @@ 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::Left) => println!("Cancelled"), - Ok(Button::Middle) => println!("How did you even press this?"), - Err(_) => println!("Oh noes, an error happened!"), + 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!"), } } diff --git a/ctru-rs/src/applets/swkbd.rs b/ctru-rs/src/applets/swkbd.rs index 0a620e2..c4e8c3e 100644 --- a/ctru-rs/src/applets/swkbd.rs +++ b/ctru-rs/src/applets/swkbd.rs @@ -1,3 +1,4 @@ +use bitflags::bitflags; use ctru_sys::{ self, swkbdInit, swkbdInputText, swkbdSetButton, swkbdSetFeatures, swkbdSetHintText, SwkbdState, }; diff --git a/ctru-rs/src/lib.rs b/ctru-rs/src/lib.rs index c006208..99b0b15 100644 --- a/ctru-rs/src/lib.rs +++ b/ctru-rs/src/lib.rs @@ -1,12 +1,6 @@ #![crate_type = "rlib"] #![crate_name = "ctru"] -#[macro_use] -extern crate bitflags; -extern crate ctru_sys; -extern crate libc; -extern crate widestring; - /// Call this somewhere to force Rust to link some required crates /// This is also a setup for some crate integration only available at runtime /// diff --git a/ctru-rs/src/services/fs.rs b/ctru-rs/src/services/fs.rs index c8293c0..c4e95e0 100644 --- a/ctru-rs/src/services/fs.rs +++ b/ctru-rs/src/services/fs.rs @@ -3,18 +3,17 @@ //! This module contains basic methods to manipulate the contents of the 3DS's filesystem. //! Only the SD card is currently supported. +use bitflags::bitflags; +use std::ffi::OsString; use std::io::Error as IoError; use std::io::ErrorKind as IoErrorKind; use std::io::Result as IoResult; use std::io::{Read, Seek, SeekFrom, Write}; - -use std::ffi::OsString; use std::mem; use std::path::{Path, PathBuf}; use std::ptr; use std::slice; use std::sync::Arc; - use widestring::{WideCStr, WideCString}; bitflags! { diff --git a/ctru-rs/src/services/hid.rs b/ctru-rs/src/services/hid.rs index f51f341..7f27d80 100644 --- a/ctru-rs/src/services/hid.rs +++ b/ctru-rs/src/services/hid.rs @@ -4,7 +4,7 @@ //! and circle pad information. It also provides information from the sound volume slider, //! the accelerometer, and the gyroscope. -bitflags! { +bitflags::bitflags! { /// A set of flags corresponding to the button and directional pad /// inputs on the 3DS #[derive(Default)] diff --git a/ctru-sys/src/lib.rs b/ctru-sys/src/lib.rs index 40ffd94..ccc6540 100644 --- a/ctru-sys/src/lib.rs +++ b/ctru-sys/src/lib.rs @@ -3,6 +3,4 @@ #![allow(non_snake_case)] #![no_std] -extern crate libc; - include!("bindings.rs");