Skip to content

Commit 50a617b

Browse files
Don't use invisible(), if not needed
1 parent 3c45442 commit 50a617b

10 files changed

+23
-23
lines changed

R/backend_api-ClusterFutureBackend-class.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ launchFuture.ClusterFutureBackend <- function(backend, future, ...) {
284284

285285
if (debug) mdebugf("%s started", class(future)[1])
286286

287-
invisible(future)
287+
future
288288
}
289289

290290

@@ -360,7 +360,7 @@ ClusterRegistry <- local({
360360
last <<- NULL
361361
}
362362

363-
invisible(cluster)
363+
cluster
364364
}
365365
}) ## ClusterRegistry()
366366

R/backend_api-FutureRegistry.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ FutureRegistry <- local({
4343
}
4444
} ## for (ii ...)
4545

46-
invisible(futures)
46+
futures
4747
} ## collectValues()
4848

4949

R/backend_api-MulticoreFutureBackend-class.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ requestCore <- function(await, workers = availableCores(), timeout = getOption("
194194
stop(msg)
195195
}
196196

197-
invisible(unname(finished))
197+
unname(finished)
198198
}
199199

200200
#' A MulticoreFutureBackend resolves futures in parallel using forked processing on the current machine
@@ -289,7 +289,7 @@ launchFuture.MulticoreFutureBackend <- local({
289289

290290
if (debug) mdebugf("%s started", class(future)[1])
291291

292-
invisible(future)
292+
future
293293
}
294294
})
295295

R/backend_api-UniprocessFuture-class.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ run.UniprocessFuture <- function(future, ...) {
4848
## Signal conditions early, iff specified for the given future
4949
signalEarly(future, collect = FALSE)
5050

51-
invisible(future)
51+
future
5252
}
5353

5454

R/protected_api-journal.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ makeFutureJournal <- function(x, event = "create", category = "other", parent =
280280
data <- data.frame(event = event, category = category, parent = parent, start = start, stop = stop)
281281
class(data) <- c("FutureJournal", class(data))
282282
x[[".journal"]] <- data
283-
invisible(x)
283+
x
284284
}
285285

286286
updateFutureJournal <- function(x, event, start = NULL, stop = Sys.time()) {
@@ -306,7 +306,7 @@ updateFutureJournal <- function(x, event, start = NULL, stop = Sys.time()) {
306306
data[row, ] <- entry
307307
stop_if_not(inherits(data, "FutureJournal"))
308308
x[[".journal"]] <- data
309-
invisible(x)
309+
x
310310
}
311311

312312

@@ -327,7 +327,7 @@ appendToFutureJournal <- function(x, event, category = "other", parent = NA_char
327327

328328
data <- data.frame(event = event, category = category, parent = parent, start = start, stop = stop)
329329
x[[".journal"]] <- rbind(x[[".journal"]], data)
330-
invisible(x)
330+
x
331331
}
332332

333333

R/protected_api-signalConditions.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#' @keywords internal
2727
signalConditions <- function(future, include = "condition", exclude = NULL, resignal = TRUE, ...) {
2828
## Nothing to do?
29-
if (length(include) == 0L) return(invisible(future))
29+
if (length(include) == 0L) return(future)
3030

3131
## Future is not yet launched
3232
if (!future[["state"]] %in% c("finished", "failed", "interrupted")) {
@@ -43,7 +43,7 @@ signalConditions <- function(future, include = "condition", exclude = NULL, resi
4343
conditions <- result[["conditions"]]
4444

4545
## Nothing to do
46-
if (length(conditions) == 0) return(invisible(future))
46+
if (length(conditions) == 0) return(future)
4747

4848
debug <- isTRUE(getOption("future.debug"))
4949

@@ -109,7 +109,7 @@ signalConditions <- function(future, include = "condition", exclude = NULL, resi
109109
future <- resetFuture(backend, future)
110110
}
111111
warning(FutureInterruptWarning(msg, future = future))
112-
return(invisible(future))
112+
return(future)
113113
} else if (inherits(condition, "warning")) {
114114
warning(condition)
115115
} else if (inherits(condition, "message")) {
@@ -131,7 +131,7 @@ signalConditions <- function(future, include = "condition", exclude = NULL, resi
131131
result[["conditions"]] <- conditions
132132
future[["result"]] <- result
133133

134-
invisible(future)
134+
future
135135
}
136136

137137

@@ -145,7 +145,7 @@ signalImmediateConditions <- function(future, include = NULL, resignal = FALSE,
145145
if (is.null(include)) include <- "immediateCondition"
146146
}
147147
}
148-
if (length(include) == 0L) return(invisible(future))
148+
if (length(include) == 0L) return(future)
149149
signalConditions(future, include = include, resignal = resignal, ...)
150150
}
151151

@@ -284,5 +284,5 @@ muffleCondition <- function(cond, pattern = "^muffle") {
284284
}
285285
}
286286

287-
invisible(muffled)
287+
muffled
288288
} ## muffleCondition()

R/utils-basic.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ assign_globals <- function(envir, globals, exclude = getOption("future.assign_gl
185185

186186
if (debug) mdebug("assign_globals() ... done")
187187

188-
invisible(envir)
188+
envir
189189
}
190190

191191

@@ -231,14 +231,14 @@ grmall <- local(function(envir = .GlobalEnv) {
231231
vars <- ls(envir = envir, all.names = TRUE)
232232
rm(list = vars, envir = envir, inherits = FALSE)
233233
## Return a value identifiable for troubleshooting purposes
234-
invisible("future-grmall")
234+
"future-grmall"
235235
})
236236

237237
## Assigns a value to the global environment.
238238
gassign <- local(function(name, value, envir = .GlobalEnv) {
239239
assign(name, value = value, envir = envir)
240240
## Return a value identifiable for troubleshooting purposes
241-
invisible("future-grassign")
241+
"future-grassign"
242242
})
243243

244244
## Evaluates an expression in global environment.

R/utils-immediateCondition.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ readImmediateConditions <- function(path = immediateConditionsPath(rootPath = ro
115115
## Remove files?
116116
if (remove && length(files) > 0L) file.remove(files)
117117

118-
invisible(conds)
118+
conds
119119
}
120120

121121

@@ -146,7 +146,7 @@ saveImmediateCondition <- function(cond, path = immediateConditionsPath(rootPath
146146
#'
147147
#' @param \ldots (optional) Additional arguments passed to [base::saveRDS()].
148148
#'
149-
#' @return (invisible) The pathname of the RDS written.
149+
#' @return The pathname of the RDS written.
150150
#'
151151
#' @details
152152
#' Uses [base::saveRDS] internally but writes the object atomically by first
@@ -185,7 +185,7 @@ save_rds <- function(object, pathname, ...) {
185185
stop(msg)
186186
}
187187

188-
invisible(pathname)
188+
pathname
189189
}
190190

191191

R/utils-signalEarly.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ signalEarly <- function(future, collect = TRUE, .signalEarly = TRUE, ...) {
4444

4545
if (debug) mdebug("signalEarly() ... DONE")
4646

47-
invisible(future)
47+
future
4848
}

man/save_rds.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)