Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Unified Diff: utils/pub/oauth2.dart

Issue 12042053: Get rid of unneeded Future.immediate() calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: utils/pub/oauth2.dart
diff --git a/utils/pub/oauth2.dart b/utils/pub/oauth2.dart
index 24d798afd60d75223937e6394a2d2d4e7dbee613..206eb53af2a540ab657b570917096d0f5f65c8d5 100644
--- a/utils/pub/oauth2.dart
+++ b/utils/pub/oauth2.dart
@@ -56,7 +56,6 @@ Future clearCredentials(SystemCache cache) {
var credentialsFile = _credentialsFile(cache);
return fileExists(credentialsFile).then((exists) {
if (exists) return deleteFile(credentialsFile);
- return new Future.immediate(null);
});
}
@@ -97,8 +96,8 @@ Future withClient(SystemCache cache, Future fn(Client client)) {
Future<Client> _getClient(SystemCache cache) {
return _loadCredentials(cache).then((credentials) {
if (credentials == null) return _authorize();
- return new Future.immediate(new Client(
- _identifier, _secret, credentials, httpClient: curlClient));
+ return new Client(_identifier, _secret, credentials,
+ httpClient: curlClient);
}).then((client) {
return _saveCredentials(cache, client.credentials).then((_) => client);
});
@@ -119,7 +118,7 @@ Future<Credentials> _loadCredentials(SystemCache cache) {
return fileExists(path).then((credentialsExist) {
if (!credentialsExist) {
log.fine('No credentials found at $path.');
- return new Future.immediate(null);
+ return;
}
return readTextFile(_credentialsFile(cache)).then((credentialsJson) {
« utils/pub/entrypoint.dart ('K') | « utils/pub/io.dart ('k') | utils/pub/pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698