diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/UserData.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/UserData.php
index 06b352f..7122dc6 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/UserData.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/UserData.php
@@ -37,7 +37,7 @@ class UserData extends FieldPluginBase {
   public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
     parent::init($view, $display, $options);
 
-    $this->userData = drupal_container()->get('user.data');
+    $this->userData = \Drupal::service('user.data');
   }
 
   /**
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
index 5b622e1..aa11966 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
@@ -71,7 +71,7 @@ function testUserCancelUid1() {
     $password = user_password();
     $account = array(
       'name' => 'user1',
-      'pass' => drupal_container()->get('password')->hash(trim($password)),
+      'pass' => $this->container->get('password')->hash(trim($password)),
     );
     // We cannot use $account->save() here, because this would result in the
     // password being hashed again.
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php b/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php
index 36c5f47..514bbb7 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php
@@ -107,7 +107,7 @@ function testPasswordRehashOnLogin() {
     $default_count_log2 = 16;
 
     // Retrieve instance of password hashing algorithm
-    $password_hasher = drupal_container()->get('password');
+    $password_hasher =  $this->container->get('password');
 
     // Create a new user and authenticate.
     $account = $this->drupalCreateUser(array());
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index abfe84b..f92736b 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -634,7 +634,7 @@ function user_validate_current_pass(&$form, &$form_state) {
     // form values like password_confirm that have their own validation
     // that prevent them from being empty if they are changed.
     if ((strlen(trim($form_state['values'][$key])) > 0) && ($form_state['values'][$key] != $account->$key)) {
-      $current_pass_failed = empty($form_state['values']['current_pass']) || !drupal_container()->get('password')->check($form_state['values']['current_pass'], $account);
+      $current_pass_failed = empty($form_state['values']['current_pass']) || !Drupal::service('password')->check($form_state['values']['current_pass'], $account);
       if ($current_pass_failed) {
         form_set_error('current_pass', t("Your current password is missing or incorrect; it's required to change the %name.", array('%name' => $name)));
         form_set_error($key);
@@ -1288,7 +1288,7 @@ function user_login_name_validate($form, &$form_state) {
 function user_login_authenticate_validate($form, &$form_state) {
   $password = trim($form_state['values']['pass']);
   $flood_config = config('user.flood');
-  $flood = Drupal::service('flood');
+  $flood = Drupal::flood();
   if (!empty($form_state['values']['name']) && !empty($password)) {
     // Do not allow any login from the current user's IP if the limit has been
     // reached. Default is 50 failed attempts allowed in one hour. This is
@@ -1336,7 +1336,7 @@ function user_login_authenticate_validate($form, &$form_state) {
  */
 function user_login_final_validate($form, &$form_state) {
   $flood_config = config('user.flood');
-  $flood = Drupal::service('flood');
+  $flood = Drupal::flood();
   if (empty($form_state['uid'])) {
     // Always register an IP-based failed login event.
     $flood->register('user.failed_login_ip', $flood_config->get('ip_window'));
@@ -1388,7 +1388,7 @@ function user_authenticate($name, $password) {
   if (!empty($name) && !empty($password)) {
     $account = user_load_by_name($name);
     if ($account) {
-      $password_hasher = drupal_container()->get('password');
+      $password_hasher = Drupal::service('password');
       if ($password_hasher->check($password, $account)) {
         // Successful authentication.
         $uid = $account->uid;
@@ -2609,7 +2609,7 @@ function user_modules_uninstalled($modules) {
      ->condition('module', $modules, 'IN')
      ->execute();
   // Remove any potentially orphan module data stored for users.
-  drupal_container()->get('user.data')->delete($modules);
+  Drupal::service('user.data')->delete($modules);
 }
 
 /**
diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc
index ed1e029..477e40e 100644
--- a/core/modules/user/user.pages.inc
+++ b/core/modules/user/user.pages.inc
@@ -394,7 +394,7 @@ function user_cancel_confirm($account, $timestamp = 0, $hashed_pass = '') {
   $current = REQUEST_TIME;
 
   // Basic validation of arguments.
-  $account_data = drupal_container()->get('user.data')->get('user', $account->id());
+  $account_data = Drupal::service('user.data')->get('user', $account->id());
   if (isset($account_data['cancel_method']) && !empty($timestamp) && !empty($hashed_pass)) {
     // Validate expiration and hashed password/login.
     if ($timestamp <= $current && $current - $timestamp < $timeout && $account->uid && $timestamp >= $account->login && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
diff --git a/core/modules/user/user.views.inc b/core/modules/user/user.views.inc
index 58f6a51..8ac57e6 100644
--- a/core/modules/user/user.views.inc
+++ b/core/modules/user/user.views.inc
@@ -281,7 +281,7 @@ function user_views_data() {
     ),
   );
 
-  if (drupal_container()->get('module_handler')->moduleExists('translation_entity')) {
+  if (Drupal::moduleHandler()->moduleExists('translation_entity')) {
     $data['users']['translation_link'] = array(
       'title' => t('Translation link'),
       'help' => t('Provide a link to the translations overview for users.'),
