Remove use of 'label_break_value' feature.

This commit is contained in:
Jacob Pratt 2019-09-10 20:14:12 -04:00 committed by Sergio Benitez
parent 2537a1164d
commit b95b6765e1
2 changed files with 11 additions and 16 deletions

View File

@ -1,7 +1,6 @@
#![feature(try_trait)] #![feature(try_trait)]
#![feature(proc_macro_hygiene)] #![feature(proc_macro_hygiene)]
#![feature(crate_visibility_modifier)] #![feature(crate_visibility_modifier)]
#![feature(label_break_value)]
#![recursion_limit="256"] #![recursion_limit="256"]

View File

@ -195,23 +195,19 @@ impl<'f, T: FromForm<'f>> FromData<'f> for Form<T> {
) -> Transform<Outcome<Self::Owned, Self::Error>> { ) -> Transform<Outcome<Self::Owned, Self::Error>> {
use std::{cmp::min, io::Read}; use std::{cmp::min, io::Read};
let outcome = 'o: { if !request.content_type().map_or(false, |ct| ct.is_form()) {
if !request.content_type().map_or(false, |ct| ct.is_form()) { warn_!("Form data does not have form content type.");
warn_!("Form data does not have form content type."); return Transform::Borrowed(Forward(data))
break 'o Forward(data); }
}
let limit = request.limits().forms; let limit = request.limits().forms;
let mut stream = data.open().take(limit); let mut stream = data.open().take(limit);
let mut form_string = String::with_capacity(min(4096, limit) as usize); let mut form_string = String::with_capacity(min(4096, limit) as usize);
if let Err(e) = stream.read_to_string(&mut form_string) { if let Err(e) = stream.read_to_string(&mut form_string) {
break 'o Failure((Status::InternalServerError, FormDataError::Io(e))); return Transform::Borrowed(Failure((Status::InternalServerError, FormDataError::Io(e))))
} }
break 'o Success(form_string); Transform::Borrowed(Success(form_string))
};
Transform::Borrowed(outcome)
} }
fn from_data(_: &Request<'_>, o: Transformed<'f, Self>) -> Outcome<Self, Self::Error> { fn from_data(_: &Request<'_>, o: Transformed<'f, Self>) -> Outcome<Self, Self::Error> {