Here it is asked Should I approve edits to off-topic questions? and here is discussed Suggested edits for questions which should be closed neither of which has made what to do in the following situation clear to me.
I've stumbled across a question which starts by asking for library suggestions (nowadays off topic) but then says "I am thinking of using following code [sic]". OP gets 2 answers: one is a poor quality set of search engine results, another is an answer which the answerer suggests might make OP's code work without having to use a library. The answer was accepted and upvoted.
So, am I allowed/encouraged/disencouraged/strictly-forbidden-under-the-pain-of-death to edit the question to remove the reference to library recommendations to bring in on topic (and at the same time freshen up the grammar etc.)? Such an edit is NOT in the "How to Edit" list, does change the meaning of the question which makes it strictly speaking "illegal", yet seems to me to be a "constructive edit" - saving a potentially off-topic question.
Does the presence of an answer to the off-topic part of the question have any impact what would be the "right thing to do" here?
Perhaps the question should be edited and the answer should be flagged? Perhaps the presence of an answer to the off-topic part of the question means the question should be flagged?