Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up warnings. #1433

Merged
merged 2 commits into from Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion SECURITY.md
Expand Up @@ -3,7 +3,7 @@
## Supported Versions

| Version | Supported |
| ------- | ------------------ |
|---------|--------------------|
| All | :white_check_mark: |

## Reporting a Vulnerability
Expand Down
2 changes: 1 addition & 1 deletion coil-base/src/androidTest/java/coil/EventListenerTest.kt
Expand Up @@ -196,7 +196,7 @@ class EventListenerTest {

private suspend fun ImageLoader.testEnqueue(
builder: ImageRequest.Builder.() -> Unit
) = suspendCancellableCoroutine<Unit> { continuation ->
) = suspendCancellableCoroutine { continuation ->
val request = ImageRequest.Builder(context)
.size(100, 100)
.target(activityRule.scenario.activity.imageView)
Expand Down
Expand Up @@ -241,7 +241,7 @@ class RealImageLoaderAndroidTest {
val error = ColorDrawable(Color.BLUE)
val fallback = ColorDrawable(Color.BLACK)

suspendCancellableCoroutine<Unit> { continuation ->
suspendCancellableCoroutine { continuation ->
var hasCalledTargetOnError = false

val request = ImageRequest.Builder(context)
Expand Down Expand Up @@ -295,7 +295,7 @@ class RealImageLoaderAndroidTest {
val fileName = IMAGE
val bitmap = decodeAssetAndAddToMemoryCache(key, fileName)

suspendCancellableCoroutine<Unit> { continuation ->
suspendCancellableCoroutine { continuation ->
val request = ImageRequest.Builder(context)
.memoryCacheKey(key)
.placeholderMemoryCacheKey(key)
Expand Down Expand Up @@ -621,7 +621,7 @@ class RealImageLoaderAndroidTest {

assertNull(imageView.drawable)

suspendCancellableCoroutine<Unit> { continuation ->
suspendCancellableCoroutine { continuation ->
val request = ImageRequest.Builder(context)
.data(data)
.target(imageView)
Expand Down
9 changes: 2 additions & 7 deletions coil-base/src/main/java/coil/disk/DiskLruCache.kt
Expand Up @@ -547,9 +547,6 @@ internal class DiskLruCache(
return true
}

// Prevent the edit from completing normally.
entry.currentEditor?.detach()

for (i in 0 until valueCount) {
fileSystem.delete(entry.cleanFiles[i])
size -= entry.lengths[i]
Expand Down Expand Up @@ -586,10 +583,8 @@ internal class DiskLruCache(

// Copying for concurrent iteration.
for (entry in lruEntries.values.toTypedArray()) {
if (entry.currentEditor != null) {
// Prevent the edit from completing normally.
entry.currentEditor?.detach()
}
// Prevent the edit from completing normally.
entry.currentEditor?.detach()
}

trimToSize()
Expand Down
2 changes: 1 addition & 1 deletion coil-base/src/main/java/coil/util/Lifecycles.kt
Expand Up @@ -20,7 +20,7 @@ internal suspend fun Lifecycle.awaitStarted() {
// Slow path: observe the lifecycle until we're started.
var observer: LifecycleObserver? = null
try {
suspendCancellableCoroutine<Unit> { continuation ->
suspendCancellableCoroutine { continuation ->
observer = object : DefaultLifecycleObserver {
override fun onStart(owner: LifecycleOwner) {
continuation.resume(Unit)
Expand Down
Expand Up @@ -110,13 +110,11 @@ class CrossfadeTransitionTest {
crossinline onStart: (placeholder: Drawable?) -> Unit = { fail() },
crossinline onError: (error: Drawable?) -> Unit = { fail() },
crossinline onSuccess: (result: Drawable) -> Unit = { fail() }
): TransitionTarget {
return object : TransitionTarget {
override val view = imageView
override val drawable: Drawable? get() = imageView.drawable
override fun onStart(placeholder: Drawable?) = onStart(placeholder)
override fun onError(error: Drawable?) = onError(error)
override fun onSuccess(result: Drawable) = onSuccess(result)
}
) = object : TransitionTarget {
override val view = imageView
override val drawable: Drawable? get() = imageView.drawable
override fun onStart(placeholder: Drawable?) = onStart(placeholder)
override fun onError(error: Drawable?) = onError(error)
override fun onSuccess(result: Drawable) = onSuccess(result)
}
}