Skip to content

Commit 2737820

Browse files
committed
use Try.flatMap with List.map
1 parent 7c3e289 commit 2737820

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

compiler/src/dotty/tools/dotc/plugins/Plugin.scala

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,16 @@ object Plugin {
143143
}
144144

145145
val seen = mutable.HashSet[String]()
146-
val enabled = (fromPaths ::: fromDirs) map {
147-
case Success((pd, loader)) if seen(pd.classname) =>
146+
val enabled = (fromPaths ::: fromDirs) map(_.flatMap {
147+
case (pd, loader) if seen(pd.classname) =>
148148
// a nod to scala/bug#7494, take the plugin classes distinctly
149149
Failure(new PluginLoadException(pd.name, s"Ignoring duplicate plugin ${pd.name} (${pd.classname})"))
150-
case Success((pd, loader)) if ignoring contains pd.name =>
150+
case (pd, loader) if ignoring contains pd.name =>
151151
Failure(new PluginLoadException(pd.name, s"Disabling plugin ${pd.name}"))
152-
case Success((pd, loader)) =>
152+
case (pd, loader) =>
153153
seen += pd.classname
154154
Plugin.load(pd.classname, loader)
155-
case Failure(e) =>
156-
Failure(e)
157-
}
155+
})
158156
enabled // distinct and not disabled
159157
}
160158

0 commit comments

Comments
 (0)