title: How to assign 2 variables simultaneously in Rust?
body: <p>I'm currently teaching myself Rust with a roguelike tutorial, and I'm attempting to get a key press to move a character diagonally which would mean <code>player_x -=1</code>, <code>player_y -= 1</code> for up left.</p>
  
  <p>No matter which way I try to arrange the code, I keep getting error messages from the compiler. I couldn't find any example of this anywhere in the documentation or on GitHub. </p>
  
  <pre><code>Key { code: Escape, .. } =&gt; return true, // exit game
  
  // movement keys
  Key { code: Up, .. } =&gt; *player_y -= 1,
  Key { code: Down, .. } =&gt; *player_y += 1,
  Key { code: Left, .. } =&gt; *player_x -= 1,
  Key { code: Right, .. } =&gt; *player_x += 1,
  Key { printable: 'k', .. } =&gt; *player_y -= 1,
  Key { printable: 'k', .. } =&gt; *player_x -= 1,
  
  _ =&gt; {}
  </code></pre>
  
  <p>You can kind of see what I'm trying to do here, but this throws an error message saying the pattern is unreachable, how would I fix this code? </p>
  
  <p>Here's <a href="https://hastebin.com/exiwageluv.php" rel="nofollow noreferrer">the full code</a>, it's fairly small, not sure what would be alone necessary to compile:</p>
  
  <pre><code>extern crate tcod;
  extern crate input;
  
  use tcod::console::*;
  use tcod::colors;
  
  // actual size of the window
  const SCREEN_WIDTH: i32 = 80;
  const SCREEN_HEIGHT: i32 = 50;
  
  const LIMIT_FPS: i32 = 20;  // 20 frames-per-second maximum
  
  
  fn handle_keys(root: &amp;mut Root, player_x: &amp;mut i32, player_y: &amp;mut i32) -&gt; bool {
      use tcod::input::Key;
      use tcod::input::KeyCode::*;
  
      let key = root.wait_for_keypress(true);
      match key {
          Key { code: Enter, alt: true, .. } =&gt; {
              // Alt+Enter: toggle fullscreen
              let fullscreen = root.is_fullscreen();
              root.set_fullscreen(!fullscreen);
          }
          Key { code: Escape, .. } =&gt; return true,  // exit game
  
          // movement keys
          Key { code: Up, .. } =&gt; *player_y -= 1,
          Key { code: Down, .. } =&gt; *player_y += 1,
          Key { code: Left, .. } =&gt; *player_x -= 1,
          Key { code: Right, .. } =&gt; *player_x += 1,
          Key { printable: 'k', ..} =&gt; *player_y -= 1,
          Key { printable: 'k', ..} =&gt; *player_x -= 1,
  
          _ =&gt; {},
      }
  
      false
  }
  
  fn main() {
      let mut root = Root::initializer()
          .font("terminal8x8_gs_tc.png", FontLayout::Tcod)
          .font_type(FontType::Greyscale)
          .size(SCREEN_WIDTH, SCREEN_HEIGHT)
          .title("Rust/libtcod tutorial")
          .init();
  
      tcod::system::set_fps(LIMIT_FPS);
  
      let mut player_x = SCREEN_WIDTH / 2;
      let mut player_y = SCREEN_HEIGHT / 2;
  
      while !root.window_closed() {
          root.set_default_foreground(colors::WHITE);
          root.put_char(player_x, player_y, '@', BackgroundFlag::None);
  
          root.flush();
  
          root.put_char(player_x, player_y, ' ', BackgroundFlag::None);
  
          // handle keys and exit game if needed
          let exit = handle_keys(&amp;mut root, &amp;mut player_x, &amp;mut player_y);
          if exit {
              break
          }
      }
  }
  </code></pre>