Skip to content

Commit 6b7f42a

Browse files
committed
fmt
1 parent 8ced128 commit 6b7f42a

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

src/sdl2/controller.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ impl GameControllerSubsystem {
114114

115115
/// Return the instance ID of the controller with player index `player_index`.
116116
#[doc(alias = "SDL_GameControllerFromPlayerIndex")]
117-
pub fn instance_id_for_player_index(&self, player_index: u32) -> Result<Option<u32>, IntegerOrSdlError> {
117+
pub fn instance_id_for_player_index(
118+
&self,
119+
player_index: u32,
120+
) -> Result<Option<u32>, IntegerOrSdlError> {
118121
let player_index = validate_int(player_index, "player_index")?;
119122

120123
let controller = unsafe { sys::SDL_GameControllerFromPlayerIndex(player_index) };
@@ -126,7 +129,7 @@ impl GameControllerSubsystem {
126129
let joystick = sys::SDL_GameControllerGetJoystick(controller);
127130
sys::SDL_JoystickInstanceID(joystick)
128131
};
129-
132+
130133
if result < 0 {
131134
// Should only fail if the joystick is NULL.
132135
panic!("{}", get_error())
@@ -587,7 +590,7 @@ impl GameController {
587590
pub fn get_player_index(&self) -> Option<u32> {
588591
let player_index = unsafe { sys::SDL_GameControllerGetPlayerIndex(self.raw) };
589592

590-
// if index is -1 (or less than 0), controller has no player
593+
// if index is -1 (or less than 0), controller has no player
591594
if player_index < 0 {
592595
None
593596
} else {

src/sdl2/joystick.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ impl JoystickSubsystem {
6262

6363
/// Return the player index of the joystick with index `device_index`.
6464
#[doc(alias = "SDL_JoystickGetDevicePlayerIndex")]
65-
pub fn player_index_for_device_id(&self, device_index: u32) -> Result<Option<u32>, IntegerOrSdlError> {
65+
pub fn player_index_for_device_id(
66+
&self,
67+
device_index: u32,
68+
) -> Result<Option<u32>, IntegerOrSdlError> {
6669
let device_index = validate_int(device_index, "device_index")?;
6770

6871
let player_index = unsafe { sys::SDL_JoystickGetDevicePlayerIndex(device_index) };
@@ -77,7 +80,10 @@ impl JoystickSubsystem {
7780

7881
/// Return the instance ID of the joystick with player index `player_index`.
7982
#[doc(alias = "SDL_JoystickFromPlayerIndex")]
80-
pub fn instance_id_for_player_index(&self, player_index: u32) -> Result<Option<u32>, IntegerOrSdlError> {
83+
pub fn instance_id_for_player_index(
84+
&self,
85+
player_index: u32,
86+
) -> Result<Option<u32>, IntegerOrSdlError> {
8187
let player_index = validate_int(player_index, "player_index")?;
8288

8389
let joystick = unsafe { sys::SDL_JoystickFromPlayerIndex(player_index) };
@@ -86,7 +92,7 @@ impl JoystickSubsystem {
8692
Ok(None)
8793
} else {
8894
let result = unsafe { sys::SDL_JoystickInstanceID(joystick) };
89-
95+
9096
if result < 0 {
9197
// Should only fail if the joystick is NULL.
9298
panic!("{}", get_error())
@@ -537,7 +543,7 @@ impl Joystick {
537543
pub fn get_player_index(&self) -> Option<u32> {
538544
let player_index = unsafe { sys::SDL_JoystickGetPlayerIndex(self.raw) };
539545

540-
// if index is -1 (or less than 0), joystick has no player
546+
// if index is -1 (or less than 0), joystick has no player
541547
if player_index < 0 {
542548
None
543549
} else {

src/sdl2/rect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ impl Rect {
236236
pub fn bottom(&self) -> i32 {
237237
self.raw.y + self.raw.h
238238
}
239-
239+
240240
/// Returns the origin of the rectangle (Top Left)
241241
///
242242
/// ```
@@ -246,7 +246,7 @@ impl Rect {
246246
pub fn origin(&self) -> (i32, i32) {
247247
(self.left(), self.top())
248248
}
249-
249+
250250
/// Shifts this rectangle to the left by `offset`.
251251
///
252252
/// # Example

0 commit comments

Comments
 (0)