Skip to content

Commit cc57d09

Browse files
committed
Fix formatting
1 parent a379199 commit cc57d09

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

src/Bridges/bridge.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ end
121121

122122
function _attribute_error_message(attr, bridge, action)
123123
return "Bridge of type `$(nameof(typeof(bridge)))` does not support " *
124-
"$action the attribute `$attr`. If you encountered this error " *
125-
"unexpectedly, it probably means your model has been " *
126-
"reformulated using the bridge, and you are attempting to query " *
127-
"an attribute that we haven't implemented yet for this bridge. " *
128-
"Please open an issue at https://github.com/jump-dev/MathOptInterface.jl/issues/new " *
129-
"and provide a reproducible example explaining what you were " *
130-
"trying to do."
124+
"$action the attribute `$attr`. If you encountered this error " *
125+
"unexpectedly, it probably means your model has been " *
126+
"reformulated using the bridge, and you are attempting to query " *
127+
"an attribute that we haven't implemented yet for this bridge. " *
128+
"Please open an issue at https://github.com/jump-dev/MathOptInterface.jl/issues/new " *
129+
"and provide a reproducible example explaining what you were " *
130+
"trying to do."
131131
end
132132

133133

@@ -175,13 +175,13 @@ function MOI.set(
175175
model::MOI.ModelLike,
176176
attr::MOI.AbstractConstraintAttribute,
177177
bridge::AbstractBridge,
178-
_,
178+
::Any,
179179
)
180180
message = _attribute_error_message(attr, bridge, "setting a value for")
181181
if MOI.is_copyable(attr) && !MOI.supports(model, attr, typeof(bridge))
182-
throw(MOI.UnsupportedAttribute(attr, message))
182+
return throw(MOI.UnsupportedAttribute(attr, message))
183183
else
184-
throw(MOI.SetAttributeNotAllowed(attr, message))
184+
return throw(MOI.SetAttributeNotAllowed(attr, message))
185185
end
186186
end
187187

test/Bridges/bridge_optimizer.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,11 @@ MOI.Utilities.@model(
220220

221221
struct AttributeNotAllowed <: MOI.AbstractConstraintAttribute end
222222

223-
function MOI.supports(::MOI.ModelLike, ::AttributeNotAllowed, ::Type{<:MOI.Bridges.Constraint.SplitIntervalBridge})
223+
function MOI.supports(
224+
::MOI.ModelLike,
225+
::AttributeNotAllowed,
226+
::Type{<:MOI.Bridges.Constraint.SplitIntervalBridge},
227+
)
224228
return true
225229
end
226230

@@ -237,15 +241,7 @@ function test_unsupported_constraint_attribute()
237241
MOI.LessThan{Float64},
238242
}
239243
attr = MOI.Test.UnknownConstraintAttribute()
240-
message(action) =
241-
"Bridge of type `$(nameof(bridge))` does not support $action " *
242-
"the attribute `$attr`. If you encountered this error " *
243-
"unexpectedly, it probably means your model has been " *
244-
"reformulated using the bridge, and you are attempting to query " *
245-
"an attribute that we haven't implemented yet for this bridge. " *
246-
"Please open an issue at https://github.com/jump-dev/MathOptInterface.jl/issues/new " *
247-
"and provide a reproducible example explaining what you were " *
248-
"trying to do."
244+
message(action) = MOI._attribute_error_message(attr, bridge, action)
249245
x = MOI.add_variable(bridged_mock)
250246
ci = MOI.add_constraint(bridged_mock, x, MOI.Interval(0.0, 1.0))
251247
@test !MOI.Bridges.is_bridged(bridged_mock, ci)

0 commit comments

Comments
 (0)