It is not wrong and will be equivalent to a t test that assumes equal variances. Moreover, with two groups, sqrt(f-statistic) equals the (aboslute value of the) t-statistic. I am somewhat confident that a t-test with unequal variances is not equivalent. Since you can get appropriate estimates when the variances are unequal (variances are generally always unequal to some decimal place), it probably makes sense to use the t-test as it is more flexible than an ANOVA (assuming you only have two groups).
Update:
Here is code to show that the t-statistic^2 for the equal variance t-test, but not the unequal t-test, is the same as the f-statistic.
dat_mtcars <- mtcars
# unequal variance model
t_unequal <- t.test(mpg ~ factor(vs), data = dat_mtcars)
t_stat_unequal <- t_unequal$statistic
# assume equal variance
t_equal <- t.test(mpg ~ factor(vs), var.equal = TRUE, data = dat_mtcars)
t_stat_equal <- t_equal$statistic
# anova
a_equal <- aov(mpg ~ factor(vs), data = dat_mtcars)
f_stat <- anova(a_equal)
f_stat$`F value`[1]
# compare by dividing (1 = equivalence)
(t_stat_unequal^2) / f_stat$`F value`[1]
(t_stat_equal^2) / f_stat$`F value`[1] # (t-stat with equal var^2) = F